Class MultiOutputStream

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

public class MultiOutputStream extends OutputStream
Writes to multiple output streams in sequence, stopping at the first failure.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new MultiOutputStream that writes to the given output streams.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes each output stream, stopping at the first failure.
    void
    write(byte[] b)
    Writes the specified byte array to all output streams.
    void
    write(byte[] b, int off, int len)
    Writes the specified byte array to all output streams.
    void
    write(int b)
    Writes the specified byte to all output streams.

    Methods inherited from class java.io.OutputStream

    flush, nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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
      Closes each output stream, stopping at the first failure.
      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.