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.OutputStream
Dispatch 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 void
close()
Close the streams.void
flush()
Flush the streams.java.io.OutputStream[]
getOutputStreams()
Get the output streams.void
setEnabled(java.io.OutputStream out, boolean enabled)
Set the enabled state of a stream.void
setOutputStreams(java.io.OutputStream[] outs)
Set the output streams.void
write(byte[] b, int off, int len)
Write a byte array to the streams.void
write(int b)
Write a byte to the streams.
-
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
Write a byte to the streams.- Specified by:
write
in classjava.io.OutputStream
- Parameters:
b
- The byte.- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
Write a byte array to the streams.- Overrides:
write
in 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.IOException
Close the streams.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
Flush the streams.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in 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.
-
-