Package jadex.commons
Class MultiStream
- java.lang.Object
-
- java.io.OutputStream
-
- jadex.commons.MultiStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class MultiStream extends java.io.OutputStreamDispatch the write calls to a number of specified output streams.
-
-
Constructor Summary
Constructors Constructor Description MultiStream(java.io.OutputStream[] outs)Create a new multi stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the streams.voidflush()Flush the streams.java.io.OutputStream[]getOutputStreams()Get the output streams.voidsetEnabled(java.io.OutputStream out, boolean enabled)Set the enabled state of a stream.voidsetOutputStreams(java.io.OutputStream[] outs)Set the output streams.voidwrite(byte[] b, int off, int len)Write a byte array to the streams.voidwrite(int b)Write a byte to the streams.
-
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOExceptionWrite a byte to the streams.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- The byte.- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrite a byte array to the streams.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- The byte.off- The start offset.len- The length.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionClose the streams.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlush the streams.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
getOutputStreams
public java.io.OutputStream[] getOutputStreams()
Get the output streams.- Returns:
- The output streams.
-
setOutputStreams
public void setOutputStreams(java.io.OutputStream[] outs)
Set the output streams.- Parameters:
outs- The output streams.
-
setEnabled
public void setEnabled(java.io.OutputStream out, boolean enabled)Set the enabled state of a stream.- Parameters:
out- The output stream.enabled- The enabled state.
-
-