From f46bea56f677b744824b25cb24c744fe2c755286 Mon Sep 17 00:00:00 2001 From: dupengtao <517180878@qq.com> Date: Wed, 16 Sep 2015 19:38:06 +0800 Subject: [PATCH] download file with work thread download file with work thread --- .../http/FileAsyncHttpResponseHandler.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java index da5addfcd..96bf9aea9 100755 --- a/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java @@ -63,7 +63,20 @@ public FileAsyncHttpResponseHandler(File file, boolean append) { * @param renameTargetFileIfExists whether target file should be renamed if it already exists */ public FileAsyncHttpResponseHandler(File file, boolean append, boolean renameTargetFileIfExists) { - super(); + this(file,append,renameTargetFileIfExists,false); + } + + + /** + * Obtains new FileAsyncHttpResponseHandler and stores response in passed file + * + * @param file File to store response within, must not be null + * @param append whether data should be appended to existing file + * @param renameTargetFileIfExists whether target file should be renamed if it already exists + * @param usePoolThread Whether to use the pool's thread to fire callbacks + */ + public FileAsyncHttpResponseHandler(File file, boolean append, boolean renameTargetFileIfExists,boolean usePoolThread) { + super(usePoolThread); Utils.asserts(file != null, "File passed into FileAsyncHttpResponseHandler constructor must not be null"); if (!file.isDirectory() && !file.getParentFile().isDirectory()) { Utils.asserts(file.getParentFile().mkdirs(), "Cannot create parent directories for requested File location");