Class FramedBufferInputStream

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

    public class FramedBufferInputStream
    extends java.io.InputStream
    Wrap an input stream in a framed buffer reader similar to the thrift TFramedTransport. The input stream will read one whole frame from the byte channel regardless of how many bytes are read, but can be reset at the end
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void nextFrame()
      Skip the rest of the current frame, regardless of how much has bean read / used.
      int read()  
      int read​(byte[] data)  
      int read​(byte[] data, int off, int len)  
      • Methods inherited from class java.io.InputStream

        close, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • FramedBufferInputStream

        public FramedBufferInputStream​(java.nio.channels.ReadableByteChannel in)
      • FramedBufferInputStream

        public FramedBufferInputStream​(java.nio.channels.ReadableByteChannel in,
                                       int maxFrameSize)
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(@Nonnull
                        byte[] data)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(@Nonnull
                        byte[] data,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • nextFrame

        public void nextFrame()
        Skip the rest of the current frame, regardless of how much has bean read / used.