Class CompatibleMarshallingDecoder

    • Field Detail

      • maxObjectSize

        protected final int maxObjectSize
      • discardingTooLongFrame

        private boolean discardingTooLongFrame
    • Constructor Detail

      • CompatibleMarshallingDecoder

        public CompatibleMarshallingDecoder​(UnmarshallerProvider provider,
                                            int maxObjectSize)
        Create a new instance of CompatibleMarshallingDecoder.
        Parameters:
        provider - the UnmarshallerProvider which is used to obtain the Unmarshaller for the Channel
        maxObjectSize - the maximal size (in bytes) of the Object to unmarshal. Once the size is exceeded the Channel will get closed. Use a a maxObjectSize of Integer.MAX_VALUE to disable this. You should only do this if you are sure that the received Objects will never be big and the sending side are trusted, as this opens the possibility for a DOS-Attack due an OutOfMemoryError.
    • Method Detail

      • decode

        protected java.lang.Object decode​(ChannelHandlerContext ctx,
                                          Channel channel,
                                          ChannelBuffer buffer,
                                          VoidEnum state)
                                   throws java.lang.Exception
        Description copied from class: ReplayingDecoder
        Decodes the received packets so far into a frame.
        Specified by:
        decode in class ReplayingDecoder<VoidEnum>
        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.
        state - the current decoder state (null if unused)
        Returns:
        the decoded frame
        Throws:
        java.lang.Exception
      • decodeLast

        protected java.lang.Object decodeLast​(ChannelHandlerContext ctx,
                                              Channel channel,
                                              ChannelBuffer buffer,
                                              VoidEnum state)
                                       throws java.lang.Exception
        Description copied from class: ReplayingDecoder
        Decodes the received data so far into a frame when the channel is disconnected.
        Overrides:
        decodeLast in class ReplayingDecoder<VoidEnum>
        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.
        state - the current decoder state (null if unused)
        Returns:
        the decoded frame
        Throws:
        java.lang.Exception