use of com.baidu.hugegraph.computer.core.network.buffer.NettyBuffer in project hugegraph-computer by hugegraph.
the class DataMessage method parseWithMemoryBuffer.
/**
* Decoding uses the given ByteBuf as our data.
*/
public static DataMessage parseWithMemoryBuffer(MessageType type, ByteBuf buf) {
int requestId = buf.readInt();
int partition = buf.readInt();
int bodyLength = buf.readInt();
// Slice body and retain it, the readIndex of buf will auto to body end
ByteBuf bodySlice = buf.readRetainedSlice(bodyLength);
NetworkBuffer networkBuffer = new NettyBuffer(bodySlice);
return new DataMessage(type, requestId, partition, networkBuffer);
}
Aggregations