public static int encode( final ByteBuf byteBuf, final int streamId, final int errorCode, final ByteBuf data) { final int frameLength = computeFrameLength(data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, 0, FrameType.ERROR, streamId); byteBuf.setInt(ERROR_CODE_FIELD_OFFSET, errorCode); length += Integer.BYTES; length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
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 int encode( final ByteBuf byteBuf, final int streamId, final int flags, final FrameType type, final @Nullable ByteBuf metadata, final ByteBuf data) { if (Frame.isFlagSet(flags, FrameHeaderFlyweight.FLAGS_M) != (metadata != null)) { throw new IllegalArgumentException("metadata flag set incorrectly"); } if (type.hasInitialRequestN()) { throw new AssertionError(type + " must not be encoded without initial request N"); } final int frameLength = computeFrameLength( type, metadata != null ? metadata.readableBytes() : null, data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, type, streamId); length += FrameHeaderFlyweight.encodeMetadata(byteBuf, type, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
public static int encode( final ByteBuf byteBuf, final int streamId, int flags, final FrameType type, final int initialRequestN, final @Nullable ByteBuf metadata, final ByteBuf data) { if (Frame.isFlagSet(flags, FrameHeaderFlyweight.FLAGS_M) != (metadata != null)) { throw new IllegalArgumentException("metadata flag set incorrectly"); } final int frameLength = computeFrameLength( type, metadata != null ? metadata.readableBytes() : null, data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, type, streamId); byteBuf.setInt(INITIAL_REQUEST_N_FIELD_OFFSET, initialRequestN); length += Integer.BYTES; length += FrameHeaderFlyweight.encodeMetadata(byteBuf, type, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
length += encodeData(byteBuf, length, data);
length += FrameHeaderFlyweight.encodeData(byteBuf, length, data);
public static int encode( final ByteBuf byteBuf, final int streamId, final int errorCode, final ByteBuf data) { final int frameLength = computeFrameLength(data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, 0, FrameType.ERROR, streamId); byteBuf.setInt(ERROR_CODE_FIELD_OFFSET, errorCode); length += Integer.BYTES; length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
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 int encode( final ByteBuf byteBuf, final int streamId, final int flags, final FrameType type, final @Nullable ByteBuf metadata, final ByteBuf data) { if (Frame.isFlagSet(flags, FrameHeaderFlyweight.FLAGS_M) != (metadata != null)) { throw new IllegalArgumentException("metadata flag set incorrectly"); } if (type.hasInitialRequestN()) { throw new AssertionError(type + " must not be encoded without initial request N"); } final int frameLength = computeFrameLength( type, metadata != null ? metadata.readableBytes() : null, data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, type, streamId); length += FrameHeaderFlyweight.encodeMetadata(byteBuf, type, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
public static int encode( final ByteBuf byteBuf, final int streamId, int flags, final FrameType type, final int initialRequestN, final @Nullable ByteBuf metadata, final ByteBuf data) { if (Frame.isFlagSet(flags, FrameHeaderFlyweight.FLAGS_M) != (metadata != null)) { throw new IllegalArgumentException("metadata flag set incorrectly"); } final int frameLength = computeFrameLength( type, metadata != null ? metadata.readableBytes() : null, data.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, flags, type, streamId); byteBuf.setInt(INITIAL_REQUEST_N_FIELD_OFFSET, initialRequestN); length += Integer.BYTES; length += FrameHeaderFlyweight.encodeMetadata(byteBuf, type, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data); return length; }
length += encodeData(byteBuf, length, data);
length += FrameHeaderFlyweight.encodeData(byteBuf, length, data);