Class MarshallingDecoder

  • All Implemented Interfaces:
    io.netty5.channel.ChannelHandler

    public class MarshallingDecoder
    extends io.netty5.handler.codec.LengthFieldBasedFrameDecoder
    Decoder which MUST be used with MarshallingEncoder.

    A LengthFieldBasedFrameDecoder which use an Unmarshaller to read the Object out of the Buffer.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.netty5.handler.codec.ByteToMessageDecoder

        io.netty5.handler.codec.ByteToMessageDecoder.Cumulator
    • Field Summary

      • Fields inherited from class io.netty5.handler.codec.ByteToMessageDecoder

        COMPOSITE_CUMULATOR, MERGE_CUMULATOR
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Object decode0​(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer in)  
      • Methods inherited from class io.netty5.handler.codec.LengthFieldBasedFrameDecoder

        decode, extractFrame, getUnadjustedFrameLength
      • Methods inherited from class io.netty5.handler.codec.ByteToMessageDecoder

        actualReadableBytes, channelInactive, channelRead, channelReadComplete, channelShutdown, decodeLast, discardSomeReadBytes, handlerAdded, handlerAdded0, handlerRemoved, handlerRemoved0, internalBuffer, isSharable, isSingleDecode, setSingleDecode
      • Methods inherited from interface io.netty5.channel.ChannelHandler

        bind, channelActive, channelExceptionCaught, channelInboundEvent, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
    • Constructor Detail

      • MarshallingDecoder

        public MarshallingDecoder​(UnmarshallerProvider provider)
        Creates a new decoder whose maximum object size is 1048576 bytes. If the size of the received object is greater than 1048576 bytes, a StreamCorruptedException will be raised.
      • MarshallingDecoder

        public MarshallingDecoder​(UnmarshallerProvider provider,
                                  int maxObjectSize)
        Creates a new decoder with the specified maximum object size.
        Parameters:
        maxObjectSize - the maximum byte length of the serialized object. if the length of the received object is greater than this value, TooLongFrameException will be raised.
    • Method Detail

      • decode0

        protected Object decode0​(io.netty5.channel.ChannelHandlerContext ctx,
                                 io.netty5.buffer.Buffer in)
                          throws Exception
        Overrides:
        decode0 in class io.netty5.handler.codec.LengthFieldBasedFrameDecoder
        Throws:
        Exception