code: protected Object decode(ChannelHandlerContext channelHandlerContext, Channel channel, ChannelBuffer channelBuffer) throws Exception {
          // Wait until the length prefix is available.
          if (channelBuffer.readableBytes() < 4) {
              // If null is returned, it means there is not enough data yet.
              // FrameDecoder will call again when there is a sufficient amount of data available.
              return null;
          }
  
          //marking the current reading position
          channelBuffer.markReaderIndex();
  
          //get the fragment size and wait until the entire fragment is available.
          long fragSize = channelBuffer.readUnsignedInt();
          boolean lastFragment = RecordMarkingUtil.isLastFragment(fragSize);
          fragSize = RecordMarkingUtil.maskFragmentSize(fragSize);
          if (channelBuffer.readableBytes() < fragSize) {
              channelBuffer.resetReaderIndex();
              return null;
          }
  
          //seek to the beginning of the next fragment
          channelBuffer.skipBytes((int) fragSize);
  
          _recordLength += 4 + (int) fragSize;
  
          //check the last fragment
          if (!lastFragment) {
              //not the last fragment, the data is put in an internally maintained cumulative buffer
              return null;
          }
  
          byte[] rpcResponse = new byte[_recordLength];
          channelBuffer.readerIndex(channelBuffer.readerIndex() - _recordLength);
          channelBuffer.readBytes(rpcResponse, 0, _recordLength);
  
          _recordLength = 0;
          return rpcResponse;
      }
docs: /* (non-Javadoc)
  @see org.jboss.netty.handler.codec.frame.FrameDecoder#decode(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.Channel, org.jboss.netty.buffer.ChannelBuffer)