Class MultiOutputStream

java.lang.Object
java.io.OutputStream
net.targetr.rc.client.MultiOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class MultiOutputStream extends OutputStream
An output stream that writes to multiple output streams simultaneously.
  • Constructor Details

    • MultiOutputStream

      public MultiOutputStream(OutputStream... out)
      Creates a new MultiOutputStream that writes to the given output streams.
      Parameters:
      out - The output streams to write to.
  • Method Details

    • write

      public void write(int b) throws IOException
      Writes the specified byte to all output streams.
      Specified by:
      write in class OutputStream
      Parameters:
      b - The byte to write.
      Throws:
      IOException - If an I/O error occurs.
    • write

      public void write(byte[] b) throws IOException
      Writes the specified byte array to all output streams.
      Overrides:
      write in class OutputStream
      Parameters:
      b - The byte array to write.
      Throws:
      IOException - If an I/O error occurs.
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Writes the specified byte array to all output streams.
      Overrides:
      write in class OutputStream
      Parameters:
      b - The byte array to write.
      off - The offset in the byte array to start writing from.
      len - The number of bytes to write.
      Throws:
      IOException - If an I/O error occurs.
    • close

      public void close() throws IOException
      Flushes all output streams.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - If an I/O error occurs.