Package jadex.common
Class MultiStream
java.lang.Object
java.io.OutputStream
jadex.common.MultiStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Dispatch the write calls to a number of
specified output streams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set
<OutputStream> The disabled streams.protected OutputStream[]
The output streams. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the streams.void
flush()
Flush the streams.Get the output streams.void
setEnabled
(OutputStream out, boolean enabled) Set the enabled state of a stream.void
setOutputStreams
(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.Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
outs
The output streams. -
disabled
The disabled streams.
-
-
Constructor Details
-
MultiStream
Create a new multi stream.- Parameters:
outs
- The output streams.
-
-
Method Details
-
write
Write a byte to the streams.- Specified by:
write
in classOutputStream
- Parameters:
b
- The byte.- Throws:
IOException
-
write
Write a byte array to the streams.- Overrides:
write
in classOutputStream
- Parameters:
b
- The byte.off
- The start offset.len
- The length.- Throws:
IOException
-
close
Close the streams.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
Flush the streams.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
getOutputStreams
Get the output streams.- Returns:
- The output streams.
-
setOutputStreams
Set the output streams.- Parameters:
outs
- The output streams.
-
setEnabled
Set the enabled state of a stream.- Parameters:
out
- The output stream.enabled
- The enabled state.
-