From 4bc9c7cb17decfdabcd5061afe75eb75eed1dd01 Mon Sep 17 00:00:00 2001 From: dingjinfeng Date: Tue, 15 Aug 2023 20:30:05 +0800 Subject: [PATCH] fix file size error --- .../com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java index 676c38c3..37fa2fb9 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java @@ -165,6 +165,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { fos.write(buffer, 0, len); progress(len); } + fos.flush(); handleComplete(); } catch (IOException e) { fail(new AriaHTTPException( @@ -218,6 +219,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { progress(len); } } + fos.flush(); handleComplete(); } catch (IOException e) { fail(new AriaHTTPException(String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(), @@ -257,6 +259,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { file.write(buffer, 0, len); progress(len); } + file.flush(); } /**