mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8262161: Refactor manual I/O stream copying in java.desktop to use new convenience APIs
Reviewed-by: serb, prr
This commit is contained in:
parent
4e9476071d
commit
39b1113838
11 changed files with 32 additions and 131 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1978,16 +1978,7 @@ search:
|
|||
protected static byte[] inputStreamToByteArray(InputStream str)
|
||||
throws IOException
|
||||
{
|
||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||
int len = 0;
|
||||
byte[] buf = new byte[8192];
|
||||
|
||||
while ((len = str.read(buf)) != -1) {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
|
||||
return baos.toByteArray();
|
||||
}
|
||||
return str.readAllBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue