Package jadex.common

Class MultiStream

java.lang.Object
java.io.OutputStream
jadex.common.MultiStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class MultiStream extends OutputStream
Dispatch the write calls to a number of specified output streams.
  • Field Details

  • Constructor Details

    • MultiStream

      public MultiStream(OutputStream[] outs)
      Create a new multi stream.
      Parameters:
      outs - The output streams.
  • Method Details

    • write

      public void write(int b) throws IOException
      Write a byte to the streams.
      Specified by:
      write in class OutputStream
      Parameters:
      b - The byte.
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Write a byte array to the streams.
      Overrides:
      write in class OutputStream
      Parameters:
      b - The byte.
      off - The start offset.
      len - The length.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Close the streams.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Flush the streams.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException
    • getOutputStreams

      public OutputStream[] getOutputStreams()
      Get the output streams.
      Returns:
      The output streams.
    • setOutputStreams

      public void setOutputStreams(OutputStream[] outs)
      Set the output streams.
      Parameters:
      outs - The output streams.
    • setEnabled

      public void setEnabled(OutputStream out, boolean enabled)
      Set the enabled state of a stream.
      Parameters:
      out - The output stream.
      enabled - The enabled state.