Class FixedLengthFrameDecoder

All Implemented Interfaces:
ChannelHandler, ChannelUpstreamHandler, LifeCycleAwareChannelHandler

public class FixedLengthFrameDecoder extends FrameDecoder
A decoder that splits the received ChannelBuffers by the fixed number of bytes. For example, if you received the following four fragmented packets:
 +---+----+------+----+
 | A | BC | DEFG | HI |
 +---+----+------+----+
 
A FixedLengthFrameDecoder(3) will decode them into the following three packets with the fixed length:
 +-----+-----+-----+
 | ABC | DEF | GHI |
 +-----+-----+-----+
 
  • Field Details

    • frameLength

      private final int frameLength
    • allocateFullBuffer

      private final boolean allocateFullBuffer
  • Constructor Details

    • FixedLengthFrameDecoder

      public FixedLengthFrameDecoder(int frameLength)
    • FixedLengthFrameDecoder

      public FixedLengthFrameDecoder(int frameLength, boolean allocateFullBuffer)
      Creates a new instance.
      Parameters:
      frameLength - the length of the frame
      allocateFullBuffer - true if the cumulative ChannelBuffer should use the frameLength as its initial size
  • Method Details