mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 14:26:43 -04:00
优化 GetTask 中 ByteArrayOutputStream 的初始大小 (#4209)
This commit is contained in:
parent
7ee2c51b81
commit
f95ebe2224
@ -60,9 +60,10 @@ public final class GetTask extends FetchTask<String> {
|
||||
|
||||
@Override
|
||||
protected Context getContext(URLConnection connection, boolean checkETag, String bmclapiHash) {
|
||||
return new Context() {
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int length = connection.getContentLength();
|
||||
final var baos = new ByteArrayOutputStream(length <= 0 ? 8192 : length);
|
||||
|
||||
return new Context() {
|
||||
@Override
|
||||
public void write(byte[] buffer, int offset, int len) {
|
||||
baos.write(buffer, offset, len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user