use of alluxio.network.protocol.databuffer.DataNettyBuffer in project alluxio by Alluxio.
the class RPCBlockReadResponse method decode.
/**
* Decodes the input {@link ByteBuf} into a {@link RPCBlockReadResponse} object and returns it.
*
* @param in the input {@link ByteBuf}
* @return The decoded RPCBlockReadResponse object
*/
public static RPCBlockReadResponse decode(ByteBuf in) {
long blockId = in.readLong();
long offset = in.readLong();
long length = in.readLong();
short status = in.readShort();
DataBuffer data = null;
if (length > 0) {
// use DataNettyBuffer instead of DataByteBuffer to avoid copying
data = new DataNettyBuffer(in, (int) length);
}
return new RPCBlockReadResponse(blockId, offset, length, data, Status.fromShort(status));
}
use of alluxio.network.protocol.databuffer.DataNettyBuffer in project alluxio by Alluxio.
the class RPCFileReadResponse method decode.
/**
* Decodes the input {@link ByteBuf} into a {@link RPCFileReadResponse} object and returns it.
*
* @param in the input {@link ByteBuf}
* @return The decoded RPCFileReadResponse object
*/
public static RPCFileReadResponse decode(ByteBuf in) {
long tempUfsFileId = in.readLong();
long offset = in.readLong();
long length = in.readLong();
short status = in.readShort();
DataBuffer data = null;
if (length > 0) {
data = new DataNettyBuffer(in, (int) length);
}
return new RPCFileReadResponse(tempUfsFileId, offset, length, data, Status.fromShort(status));
}
Aggregations