Package org.opends.server.util
Class MultiOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.opends.server.util.MultiOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class MultiOutputStream extends OutputStream
This class defines a simpleOutputStreamobject that can be used to write all messages to multiple targets at the same time, much like the UNIX "tee" command. Note that this class will never throw any exceptions
-
-
Constructor Summary
Constructors Constructor Description MultiOutputStream(OutputStream... targetStreams)Creates a newMultiOutputStreamobject that will write all messages to all of the target streams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes all of the underlying output streams.voidflush()Flushes all of the underlying output streams.voidwrite(byte[] b)Writes the contents of the provided byte array to all of the underlying output streams.voidwrite(byte[] b, int off, int len)Writes the specified portion of the provided byte array to all of the underlying output streams.voidwrite(int b)Writes the specified byte to the set of target output streams.-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
MultiOutputStream
public MultiOutputStream(OutputStream... targetStreams)
Creates a newMultiOutputStreamobject that will write all messages to all of the target streams.- Parameters:
targetStreams- The set of print streams to which all messages should be written. This must not benull, nor may it contain anynullelements.
-
-
Method Detail
-
close
public void close()
Closes all of the underlying output streams.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
flush
public void flush()
Flushes all of the underlying output streams.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
write
public void write(byte[] b)
Writes the contents of the provided byte array to all of the underlying output streams.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.
-
write
public void write(byte[] b, int off, int len)Writes the specified portion of the provided byte array to all of the underlying output streams.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.off- The position at which the data to write begins in the array.len- The number of bytes to b written.
-
write
public void write(int b)
Writes the specified byte to the set of target output streams.- Specified by:
writein classOutputStream- Parameters:
b- The byte to be written.
-
-