Class FramedBufferOutputStream

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

    public class FramedBufferOutputStream
    extends java.io.OutputStream
    Wrap an output stream in a framed buffer writer similar to the thrift TFramedTransport. The output stream will write everything in one single block when it is closed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void completeFrame()
      Write the frame at the current state, and reset the buffer to be able to generate a new frame.
      void write​(byte[] bytes)  
      void write​(byte[] var1, int off, int len)  
      void write​(int val)  
      • 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 Detail

      • FramedBufferOutputStream

        public FramedBufferOutputStream​(java.nio.channels.WritableByteChannel out)
      • FramedBufferOutputStream

        public FramedBufferOutputStream​(java.nio.channels.WritableByteChannel out,
                                        int maxBufferSize)
    • Method Detail

      • write

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

        public void write​(@Nonnull
                          byte[] bytes)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

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

        public void completeFrame()
                           throws java.io.IOException
        Write the frame at the current state, and reset the buffer to be able to generate a new frame.
        Throws:
        java.io.IOException - On failed write.
      • 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