Class MarshallingDecoder

    • 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

      • decode

        protected java.lang.Object decode​(ChannelHandlerContext ctx,
                                          Channel channel,
                                          ChannelBuffer buffer)
                                   throws java.lang.Exception
        Description copied from class: FrameDecoder
        Decodes the received packets so far into a frame. If an sub-class wants to extract a frame out of the buffer it should use the FrameDecoder.extractFrame(ChannelBuffer, int, int) method, to make optimizations easier later.
        Overrides:
        decode in class LengthFieldBasedFrameDecoder
        Parameters:
        ctx - the context of this handler
        channel - the current channel
        buffer - the cumulative buffer of received packets so far. Note that the buffer might be empty, which means you should not make an assumption that the buffer contains at least one byte in your decoder implementation.
        Returns:
        the decoded frame if a full frame was received and decoded. null if there's not enough data in the buffer to decode a frame.
        Throws:
        java.lang.Exception
      • extractFrame

        protected ChannelBuffer extractFrame​(ChannelBuffer buffer,
                                             int index,
                                             int length)
        Description copied from class: FrameDecoder
        Extract a Frame of the specified buffer. By default this implementation will return a extract the sub-region of the buffer and create a new one. If an sub-class want to extract a frame from the buffer it should use this method by default. Be sure that this method MUST not modify the readerIndex of the given buffer
        Overrides:
        extractFrame in class FrameDecoder