Class WrapperOutputStream

    • Field Detail

      • m_out

        protected OutputStream m_out
        The underlying OutputStream object to use.
    • Constructor Detail

      • WrapperOutputStream

        public WrapperOutputStream()
        Construct an uninitialized WrapperOutputStream.
      • WrapperOutputStream

        public WrapperOutputStream​(OutputStream out)
        Construct a WrapperOutputStream that will output to the specified OutputStream object.
        Parameters:
        out - an OutputStream object to write to
    • Method Detail

      • getOutputStream

        public OutputStream getOutputStream()
        Obtain the underlying OutputStream.
        Returns:
        the underlying OutputStream
      • ensureOutputStream

        protected OutputStream ensureOutputStream()
        Return the underlying OutputStream.
        Returns:
        the underlying OutputStream
        Throws:
        IllegalStateException - if the underlying stream has not been specified.
      • setOutputStream

        public void setOutputStream​(OutputStream out)
        Specify the underlying OutputStream. This method may only be called once with a non-null value.
        Parameters:
        out - the stream to be wrapped
        Throws:
        IllegalStateException - if the underlying stream has already been specified.
      • write

        public void write​(int b)
                   throws IOException
        Writes the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.
        Specified by:
        write in interface com.oracle.coherence.common.io.OutputStreaming
        Specified by:
        write in class OutputStream
        Parameters:
        b - the byte to write (passed as an integer)
        Throws:
        IOException - if an I/O error occurs
      • write

        public void write​(byte[] ab)
                   throws IOException
        Writes all the bytes in the array ab.
        Specified by:
        write in interface com.oracle.coherence.common.io.OutputStreaming
        Overrides:
        write in class OutputStream
        Parameters:
        ab - the byte array to write
        Throws:
        IOException - if an I/O error occurs
        NullPointerException - if ab is null
      • write

        public void write​(byte[] ab,
                          int of,
                          int cb)
                   throws IOException
        Writes cb bytes starting at offset of from the array ab.
        Specified by:
        write in interface com.oracle.coherence.common.io.OutputStreaming
        Overrides:
        write in class OutputStream
        Parameters:
        ab - the byte array to write from
        of - the offset into ab to start writing from
        cb - the number of bytes from ab to write
        Throws:
        IOException - if an I/O error occurs
        NullPointerException - if ab is null
        IndexOutOfBoundsException - if of is negative, or cb is negative, or of+cb is greater than ab.length
      • flush

        public void flush()
                   throws IOException
        Flushes this OutputStream and forces any buffered output bytes to be written.
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in interface com.oracle.coherence.common.io.OutputStreaming
        Overrides:
        flush in class OutputStream
        Throws:
        IOException - if an I/O error occurs
      • close

        public void close()
                   throws IOException
        Closes this OutputStream and releases any associated system resources.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface com.oracle.coherence.common.io.OutputStreaming
        Overrides:
        close in class OutputStream
        Throws:
        IOException - if an I/O error occurs