Class SnappyFrameDecoder

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
io.netty.handler.codec.compression.SnappyFrameDecoder
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
Direct Known Subclasses:
SnappyFramedDecoder

public class SnappyFrameDecoder extends ByteToMessageDecoder
Uncompresses a ByteBuf encoded with the Snappy framing format. See Snappy framing format. Note that by default, validation of the checksum header in each chunk is DISABLED for performance improvements. If performance is less of an issue, or if you would prefer the safety that checksum validation brings, please use the SnappyFrameDecoder(boolean) constructor with the argument set to true.
  • Constructor Details

    • SnappyFrameDecoder

      public SnappyFrameDecoder()
      Creates a new snappy-framed decoder with validation of checksums turned OFF. To turn checksum validation on, please use the alternate SnappyFrameDecoder(boolean) constructor.
    • SnappyFrameDecoder

      public SnappyFrameDecoder(boolean validateChecksums)
      Creates a new snappy-framed decoder with validation of checksums as specified.
      Parameters:
      validateChecksums - If true, the checksum field will be validated against the actual uncompressed data, and if the checksums do not match, a suitable DecompressionException will be thrown
  • Method Details

    • decode

      protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out) throws Exception
      Description copied from class: ByteToMessageDecoder
      Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.
      Specified by:
      decode in class ByteToMessageDecoder
      Parameters:
      ctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs to
      in - the ByteBuf from which to read data
      out - the List to which decoded messages should be added
      Throws:
      Exception - is thrown if an error occurs