mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8080272: Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy
Reviewed-by: mcimadamore, alanb
This commit is contained in:
parent
a31a23d5e7
commit
68deb24b38
7 changed files with 27 additions and 102 deletions
|
@ -2481,15 +2481,9 @@ public final class Main {
|
|||
// otherwise, keytool -gencrl | keytool -printcrl
|
||||
// might not work properly, since -gencrl is slow
|
||||
// and there's no data in the pipe at the beginning.
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
byte[] b = new byte[4096];
|
||||
while (true) {
|
||||
int len = in.read(b);
|
||||
if (len < 0) break;
|
||||
bout.write(b, 0, len);
|
||||
}
|
||||
byte[] bytes = in.readAllBytes();
|
||||
return CertificateFactory.getInstance("X509").generateCRLs(
|
||||
new ByteArrayInputStream(bout.toByteArray()));
|
||||
new ByteArrayInputStream(bytes));
|
||||
} finally {
|
||||
if (in != System.in) {
|
||||
in.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue