Class FramesDecoder



  • public class FramesDecoder
    extends java.lang.Object
    Frames Decoder

    collect buffers until frame decoding is possible, all decoded frames are passed to the FrameProcessor callback in order of decoding. It's a stateful class due to the fact that FramesDecoder stores buffers inside. Should be allocated only the single instance per connection.

    • Constructor Detail

      • FramesDecoder

        public FramesDecoder(FramesDecoder.FrameProcessor frameProcessor)
        Creates Frame Decoder
        Parameters:
        frameProcessor - - callback for decoded frames
      • FramesDecoder

        public FramesDecoder(FramesDecoder.FrameProcessor frameProcessor,
                             int maxFrameSize)
        Creates Frame Decoder
        Parameters:
        frameProcessor - - callback for decoded frames
        maxFrameSize - - maxFrameSize accepted by this decoder
    • Method Detail

      • decode

        public void decode(ByteBufferReference buffer)
                    throws java.io.IOException
        put next buffer into queue, if frame decoding is possible - decode all buffers and invoke FrameProcessor
        Parameters:
        buffer -
        Throws:
        java.io.IOException
      • getByte

        public int getByte()
      • getShort

        public int getShort()
      • getInt

        public int getInt()
      • getBytes

        public byte[] getBytes(int n)
      • skipBytes

        public void skipBytes(int bytecount)