8297298: SequenceInputStream should override transferTo

Reviewed-by: bpb
This commit is contained in:
Markus KARG 2022-12-07 16:29:43 +00:00 committed by Brian Burkhalter
parent dd7385d1e8
commit 389b8f4b78
2 changed files with 221 additions and 0 deletions

View file

@ -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);
}
}
}