public static Frame from(ByteBuf data, boolean respond) { final Frame frame = RECYCLER.get(); frame.setRefCnt(1); frame.content = ByteBufAllocator.DEFAULT.buffer( KeepaliveFrameFlyweight.computeFrameLength(data.readableBytes())); final int flags = respond ? KeepaliveFrameFlyweight.FLAGS_KEEPALIVE_R : 0; frame.content.writerIndex(KeepaliveFrameFlyweight.encode(frame.content, flags, data)); return frame; }
public static int encode(final ByteBuf byteBuf, int flags, final ByteBuf data) { final int frameLength = computeFrameLength(data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, FrameType.KEEPALIVE, 0); // We don't support resumability, last position is always zero byteBuf.setLong(length, 0); length += Long.BYTES; length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
public static Frame from(ByteBuf data, boolean respond) { final Frame frame = RECYCLER.get(); frame.setRefCnt(1); frame.content = ByteBufAllocator.DEFAULT.buffer( KeepaliveFrameFlyweight.computeFrameLength(data.readableBytes())); final int flags = respond ? KeepaliveFrameFlyweight.FLAGS_KEEPALIVE_R : 0; frame.content.writerIndex(KeepaliveFrameFlyweight.encode(frame.content, flags, data)); return frame; }
public static int encode(final ByteBuf byteBuf, int flags, final ByteBuf data) { final int frameLength = computeFrameLength(data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, FrameType.KEEPALIVE, 0); // We don't support resumability, last position is always zero byteBuf.setLong(length, 0); length += Long.BYTES; length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }