Optimized ProxyOutputStream;
This commit is contained in:
@@ -242,30 +242,37 @@ public class Execution {
|
|||||||
|
|
||||||
private static class ProxyOutputStream extends OutputStream {
|
private static class ProxyOutputStream extends OutputStream {
|
||||||
|
|
||||||
private final List<OutputStream> streams;
|
private final OutputStream[] streams;
|
||||||
|
|
||||||
ProxyOutputStream(final List<OutputStream> streams) {
|
ProxyOutputStream(final List<OutputStream> streams) {
|
||||||
this.streams = streams;
|
this.streams = streams.toArray(new OutputStream[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(final int b) throws IOException {
|
public void write(final int b) throws IOException {
|
||||||
for (final var stream : this.streams) {
|
for (int i = 0; i < this.streams.length; i++) {
|
||||||
stream.write(b);
|
this.streams[i].write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(final byte[] b) throws IOException {
|
||||||
|
for (int i = 0; i < this.streams.length; i++) {
|
||||||
|
this.streams[i].write(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flush() throws IOException {
|
public void flush() throws IOException {
|
||||||
for (final var stream : this.streams) {
|
for (int i = 0; i < this.streams.length; i++) {
|
||||||
stream.flush();
|
this.streams[i].flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
for (final var stream : this.streams) {
|
for (int i = 0; i < this.streams.length; i++) {
|
||||||
stream.close();
|
this.streams[i].close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user