public static ChunkFetchSuccess decode(ByteBuf buf) {
    StreamChunkId streamChunkId = StreamChunkId.decode(buf);
    buf.retain();
    NettyManagedBuffer managedBuf = new NettyManagedBuffer(buf.duplicate());
    return new ChunkFetchSuccess(streamChunkId, managedBuf);
  }
public static ChunkFetchSuccess decode ( ByteBuf buf ) { StreamChunkId streamChunkId = StreamChunkId . decode ( buf ) ; buf . retain ( ) ; NettyManagedBuffer managedBuf = new NettyManagedBuffer ( buf . duplicate ( ) ) ; return new ChunkFetchSuccess ( streamChunkId , managedBuf ) ; }
Decoding uses the given ByteBuf as our data, and will retain() it.