mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 06:17:47 -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
|
@Override
|
||||||
protected Context getContext(URLConnection connection, boolean checkETag, String bmclapiHash) {
|
protected Context getContext(URLConnection connection, boolean checkETag, String bmclapiHash) {
|
||||||
return new Context() {
|
int length = connection.getContentLength();
|
||||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
final var baos = new ByteArrayOutputStream(length <= 0 ? 8192 : length);
|
||||||
|
|
||||||
|
return new Context() {
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] buffer, int offset, int len) {
|
public void write(byte[] buffer, int offset, int len) {
|
||||||
baos.write(buffer, offset, len);
|
baos.write(buffer, offset, len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user