Class TeeOutputStream

    • Constructor Detail

      • TeeOutputStream

        public TeeOutputStream​(OutputStream output1,
                               OutputStream output2)
        Base constructor.
        Parameters:
        output1 - the output stream that is wrapped.
        output2 - a secondary stream that anything written to output1 is also written to.
    • Method Detail

      • write

        public void write​(byte[] buf,
                          int off,
                          int len)
                   throws IOException
        Description copied from class: OutputStream
        Writes count bytes from the byte array buffer starting at position offset to this stream.
        Overrides:
        write in class OutputStream
        Parameters:
        buf - the buffer to be written.
        off - the start position in buffer from where to get bytes.
        len - the number of bytes from buffer to write to this stream.
        Throws:
        IOException - if an error occurs while writing to this stream.
      • write

        public void write​(int b)
                   throws IOException
        Description copied from class: OutputStream
        Writes a single byte to this stream. Only the least significant byte of the integer oneByte is written to the stream.
        Specified by:
        write in class OutputStream
        Parameters:
        b - the byte to be written.
        Throws:
        IOException - if an error occurs while writing to this stream.
      • flush

        public void flush()
                   throws IOException
        Description copied from class: OutputStream
        Flushes this stream. Implementations of this method should ensure that any buffered data is written out. This implementation does nothing.
        Specified by:
        flush in interface Flushable
        Overrides:
        flush in class OutputStream
        Throws:
        IOException - if an error occurs while flushing this stream.
      • close

        public void close()
                   throws IOException
        Description copied from class: OutputStream
        Closes this stream. Implementations of this method should free any resources used by the stream. This implementation does nothing.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Overrides:
        close in class OutputStream
        Throws:
        IOException - if an error occurs while closing this stream.