mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8297298: SequenceInputStream should override transferTo
Reviewed-by: bpb
This commit is contained in:
parent
dd7385d1e8
commit
389b8f4b78
2 changed files with 221 additions and 0 deletions
|
@ -235,4 +235,19 @@ public class SequenceInputStream extends InputStream {
|
|||
throw ioe;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferTo(OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(out, "out");
|
||||
if (getClass() == SequenceInputStream.class) {
|
||||
long c = 0;
|
||||
while (in != null) {
|
||||
c += in.transferTo(out);
|
||||
nextStream();
|
||||
}
|
||||
return c;
|
||||
} else {
|
||||
return super.transferTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue