public class TeeOutputStream extends OutputStream
Constructor and Description |
---|
TeeOutputStream(Collection<OutputStream> outputStreams)
Constructor.
|
TeeOutputStream(OutputStream... outputStreams)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TeeOutputStream |
add(OutputStream os,
boolean close)
Adds an output stream to this tee output stream.
|
TeeOutputStream |
add(String id,
OutputStream os,
boolean close)
Same as
add(OutputStream, boolean) but associates the stream with an identifier so the stream can be
retrieved through getOutputStream(String) . |
void |
close() |
void |
flush() |
OutputStream |
getOutputStream(String id)
Returns the output stream identified through the
add(String, OutputStream, boolean) method. |
int |
size()
Returns the number of inner streams in this tee stream.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
public TeeOutputStream(OutputStream... outputStreams)
outputStreams
- The list of output streams.public TeeOutputStream(Collection<OutputStream> outputStreams)
outputStreams
- The list of output streams.public TeeOutputStream add(OutputStream os, boolean close)
os
- The output stream to add to this tee output stream.close
- If close()
on this stream will not filter to the specified output stream.public OutputStream getOutputStream(String id)
add(String, OutputStream, boolean)
method.id
- The ID associated with the output stream.public TeeOutputStream add(String id, OutputStream os, boolean close)
add(OutputStream, boolean)
but associates the stream with an identifier so the stream can be
retrieved through getOutputStream(String)
.id
- The ID to associate the output stream with.os
- The output stream to add.close
- Close the specified stream afterwards.public int size()
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.