use of org.jboss.netty.buffer.ChannelBuffer in project canal by alibaba.
the class BinlogDumpCommandBuilder method toChannelBuffer.
public ChannelBuffer toChannelBuffer(BinlogDumpCommandPacket command) throws IOException {
byte[] commandBytes = command.toBytes();
byte[] headerBytes = assembleHeaderBytes(commandBytes.length);
ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(headerBytes, commandBytes);
return buffer;
}
use of org.jboss.netty.buffer.ChannelBuffer in project canal by alibaba.
the class ChannelBufferHelper method buildChannelBufferFromCommandPacket.
public final ChannelBuffer buildChannelBufferFromCommandPacket(IPacket packet) throws IOException {
byte[] bodyBytes = packet.toBytes();
ChannelBuffer header = createHeader(bodyBytes.length, (byte) 0);
return ChannelBuffers.wrappedBuffer(header, ChannelBuffers.wrappedBuffer(bodyBytes));
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class ClientClosePacket method readBuffer.
public static ClientClosePacket readBuffer(short packetType, ChannelBuffer buffer) {
assert packetType == PacketType.CONTROL_CLIENT_CLOSE;
if (buffer.readableBytes() < 4) {
buffer.resetReaderIndex();
return null;
}
final ChannelBuffer payload = PayloadPacket.readPayload(buffer);
if (payload == null) {
return null;
}
final ClientClosePacket requestPacket = new ClientClosePacket();
return requestPacket;
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class ClientClosePacket method toBuffer.
@Override
public ChannelBuffer toBuffer() {
ChannelBuffer header = ChannelBuffers.buffer(2 + 4);
header.writeShort(PacketType.CONTROL_CLIENT_CLOSE);
return PayloadPacket.appendPayload(header, payload);
}
use of org.jboss.netty.buffer.ChannelBuffer in project pinpoint by naver.
the class ControlHandshakePacket method toBuffer.
@Override
public ChannelBuffer toBuffer() {
ChannelBuffer header = ChannelBuffers.buffer(2 + 4 + 4);
header.writeShort(PacketType.CONTROL_HANDSHAKE);
header.writeInt(getRequestId());
return PayloadPacket.appendPayload(header, payload);
}
Aggregations