Class PipelineOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class PipelineOutputStream
    extends java.io.OutputStream
    Replacement for Java's PipedOutputStream: all data written to this stream will get available in the integrated InputStream (see getInputStream()).

    Note: Usually, you will have exactly two threads: one to write and one to read. If you use a single thread, avoid reading more bytes than previously written or writing more bytes than the internal buffer can handle.

    • Constructor Detail

      • PipelineOutputStream

        public PipelineOutputStream()
      • PipelineOutputStream

        public PipelineOutputStream​(int bufferCapacity)
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
      • write

        public void write​(byte[] data,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • checkPipelineInput

        private void checkPipelineInput()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException
      • waitForBuffer

        void waitForBuffer()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • notifyBuffer

        void notifyBuffer()