Class BoundedByteBuffer.Writer

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Enclosing class:
    BoundedByteBuffer

    public class BoundedByteBuffer.Writer
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Writes data to the BoundedByteBuffer At the end of data, should write and End Of File (EOF) using the writeEOF() method Closing the Writer without EOF would throw a IOException (Broken stream) Non thread safe. Writer should be used by a single thread.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the writer & all associated resources.
      void write​(byte[] src, int offset, int length)
      Writes data to buffer.
      void writeEOF()
      Signals that stream ended successfully.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • write

        public void write​(byte[] src,
                          int offset,
                          int length)
                   throws java.lang.InterruptedException,
                          java.io.IOException
        Writes data to buffer. Cannot write more than buffer size
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • writeEOF

        public void writeEOF()
        Signals that stream ended successfully.
      • close

        public void close()
        Closes the writer & all associated resources. If close() is invoked without writeEOF() the reader side will get an IOException (broken stream).
        Specified by:
        close in interface java.lang.AutoCloseable