public static int encode( final ByteBuf byteBuf, final int ttl, final int numRequests, final ByteBuf metadata) { final int frameLength = computeFrameLength(metadata.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, 0, FrameType.LEASE, 0); byteBuf.setInt(TTL_FIELD_OFFSET, ttl); byteBuf.setInt(NUM_REQUESTS_FIELD_OFFSET, numRequests); length += Integer.BYTES * 2; length += FrameHeaderFlyweight.encodeMetadata(byteBuf, FrameType.LEASE, length, metadata); 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 += encodeMetadata(byteBuf, frameType, length, metadata); length += encodeData(byteBuf, length, data);
length += putMimeType(byteBuf, length, dataMimeType); length += FrameHeaderFlyweight.encodeMetadata(byteBuf, FrameType.SETUP, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data);
public static int encode( final ByteBuf byteBuf, final int ttl, final int numRequests, final ByteBuf metadata) { final int frameLength = computeFrameLength(metadata.readableBytes()); int length = FrameHeaderFlyweight.encodeFrameHeader(byteBuf, frameLength, 0, FrameType.LEASE, 0); byteBuf.setInt(TTL_FIELD_OFFSET, ttl); byteBuf.setInt(NUM_REQUESTS_FIELD_OFFSET, numRequests); length += Integer.BYTES * 2; length += FrameHeaderFlyweight.encodeMetadata(byteBuf, FrameType.LEASE, length, metadata); 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 += encodeMetadata(byteBuf, frameType, length, metadata); length += encodeData(byteBuf, length, data);
length += putMimeType(byteBuf, length, dataMimeType); length += FrameHeaderFlyweight.encodeMetadata(byteBuf, FrameType.SETUP, length, metadata); length += FrameHeaderFlyweight.encodeData(byteBuf, length, data);