use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class ResponsePacket method readBuffer.
public static ResponsePacket readBuffer(short packetType, ChannelBuffer buffer) {
assert packetType == PacketType.APPLICATION_RESPONSE;
if (buffer.readableBytes() < 8) {
buffer.resetReaderIndex();
return null;
}
final int messageId = buffer.readInt();
ChannelBuffer payload = PayloadPacket.readPayload(buffer);
if (payload == null) {
return null;
}
ResponsePacket responsePacket = new ResponsePacket(payload.array());
responsePacket.setRequestId(messageId);
return responsePacket;
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class SendPacket method toBuffer.
@Override
public ChannelBuffer toBuffer() {
ChannelBuffer header = ChannelBuffers.buffer(2 + 4);
header.writeShort(PacketType.APPLICATION_SEND);
return PayloadPacket.appendPayload(header, payload);
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class ServerClosePacket method readBuffer.
public static ServerClosePacket readBuffer(short packetType, ChannelBuffer buffer) {
assert packetType == PacketType.CONTROL_SERVER_CLOSE;
if (buffer.readableBytes() < 4) {
buffer.resetReaderIndex();
return null;
}
final ChannelBuffer payload = PayloadPacket.readPayload(buffer);
if (payload == null) {
return null;
}
final ServerClosePacket requestPacket = new ServerClosePacket();
return requestPacket;
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class StreamCreateFailPacket method toBuffer.
@Override
public ChannelBuffer toBuffer() {
ChannelBuffer header = ChannelBuffers.buffer(2 + 4 + 2);
header.writeShort(getPacketType());
header.writeInt(getStreamChannelId());
header.writeShort(code.value());
return header;
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class StreamCreatePacket method readBuffer.
public static StreamCreatePacket readBuffer(short packetType, ChannelBuffer buffer) {
assert packetType == PACKET_TYPE;
if (buffer.readableBytes() < 8) {
buffer.resetReaderIndex();
return null;
}
final int streamChannelId = buffer.readInt();
final ChannelBuffer payload = PayloadPacket.readPayload(buffer);
if (payload == null) {
return null;
}
final StreamCreatePacket packet = new StreamCreatePacket(streamChannelId, payload.array());
return packet;
}
Aggregations