/** * Returns a test instance of {@link RequestFireAndForgetFrame}. * * @return a test instance of {@link RequestFireAndForgetFrame} */ public static RequestFireAndForgetFrame createTestRequestFireAndForgetFrame() { return createRequestFireAndForgetFrame(DEFAULT, false, (ByteBuf) null, null); }
/** * Creates the {@code REQUEST_FNF} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param follows whether to set the Follows flag * @param metadata the metadata * @param data the data * @return the {@code REQUEST_FNF} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static RequestFireAndForgetFrame createRequestFireAndForgetFrame( ByteBufAllocator byteBufAllocator, boolean follows, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, FrameType.REQUEST_FNF); if (follows) { byteBuf = setFollowsFlag(byteBuf); } byteBuf = appendMetadata(byteBufAllocator, byteBuf, metadata); byteBuf = appendData(byteBuf, data); return RECYCLER.get().setByteBuf(byteBuf); }
@Override public ByteBuf getUnsafeData() { return getData(OFFSET_METADATA_LENGTH); }
@Override public String toString() { return "RequestFireAndForgetFrame{" + "follows=" + isFollowsFlagSet() + ", metadata=" + mapMetadata(ByteBufUtil::hexDump) + ", data=" + mapData(ByteBufUtil::hexDump) + '}'; } }
/** * Creates the {@code REQUEST_FNF} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param follows whether to set the Follows flag * @param metadata the metadata * @param data the data * @return the {@code REQUEST_FNF} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static RequestFireAndForgetFrame createRequestFireAndForgetFrame( ByteBufAllocator byteBufAllocator, boolean follows, @Nullable String metadata, @Nullable String data) { ByteBuf metadataByteBuf = getUtf8AsByteBuf(metadata); ByteBuf dataByteBuf = getUtf8AsByteBuf(data); try { return createRequestFireAndForgetFrame( byteBufAllocator, follows, metadataByteBuf, dataByteBuf); } finally { release(metadataByteBuf); release(dataByteBuf); } }
@Override public @Nullable ByteBuf getUnsafeMetadata() { return getMetadata(OFFSET_METADATA_LENGTH); }
@Override public String toString() { return "RequestFireAndForgetFrame{" + "follows=" + isFollowsFlagSet() + ", metadata=" + mapMetadata(ByteBufUtil::hexDump) + ", data=" + mapData(ByteBufUtil::hexDump) + '}'; } }
/** * Creates the {@code REQUEST_FNF} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param follows whether to set the Follows flag * @param metadata the metadata * @param data the data * @return the {@code REQUEST_FNF} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static RequestFireAndForgetFrame createRequestFireAndForgetFrame( ByteBufAllocator byteBufAllocator, boolean follows, @Nullable String metadata, @Nullable String data) { ByteBuf metadataByteBuf = getUtf8AsByteBuf(metadata); ByteBuf dataByteBuf = getUtf8AsByteBuf(data); try { return createRequestFireAndForgetFrame( byteBufAllocator, follows, metadataByteBuf, dataByteBuf); } finally { release(metadataByteBuf); release(dataByteBuf); } }
@Override public @Nullable ByteBuf getUnsafeMetadata() { return getMetadata(OFFSET_METADATA_LENGTH); }
/** * Creates the {@code REQUEST_FNF} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param follows whether to set the Follows flag * @param metadata the metadata * @param data the data * @return the {@code REQUEST_FNF} frame * @throws NullPointerException if {@code byteBufAllocator} is {@code null} */ public static RequestFireAndForgetFrame createRequestFireAndForgetFrame( ByteBufAllocator byteBufAllocator, boolean follows, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, FrameType.REQUEST_FNF); if (follows) { byteBuf = setFollowsFlag(byteBuf); } byteBuf = appendMetadata(byteBufAllocator, byteBuf, metadata); byteBuf = appendData(byteBuf, data); return RECYCLER.get().setByteBuf(byteBuf); }
public static RequestFireAndForgetFrame createTestRequestFireAndForgetFrame() { return createRequestFireAndForgetFrame(DEFAULT, false, (ByteBuf) null, null); }
@Override public ByteBuf getUnsafeData() { return getData(OFFSET_METADATA_LENGTH); }
@Override public RequestFireAndForgetFrame createFragment( ByteBufAllocator byteBufAllocator, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { return createRequestFireAndForgetFrame(byteBufAllocator, true, metadata, data); }
@Override public RequestFireAndForgetFrame createNonFragment( ByteBufAllocator byteBufAllocator, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { return createRequestFireAndForgetFrame(byteBufAllocator, false, metadata, data); }
@DisplayName( "createRequestFireAndForgetFrame throws NullPointerException with null byteBufAllocator") @Test void createRequestFireAndForgetFrameNullByteBufAllocator() { assertThatNullPointerException() .isThrownBy(() -> createRequestFireAndForgetFrame(null, false, (ByteBuf) null, null)) .withMessage("byteBufAllocator must not be null"); }
return createRequestResponseFrame(byteBuf); case REQUEST_FNF: return createRequestFireAndForgetFrame(byteBuf); case REQUEST_STREAM: return createRequestStreamFrame(byteBuf);
@Override public RequestFireAndForgetFrame createFragment( ByteBufAllocator byteBufAllocator, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { return createRequestFireAndForgetFrame(byteBufAllocator, true, metadata, data); }
@Override public RequestFireAndForgetFrame createNonFragment( ByteBufAllocator byteBufAllocator, @Nullable ByteBuf metadata, @Nullable ByteBuf data) { return createRequestFireAndForgetFrame(byteBufAllocator, false, metadata, data); }
return createRequestResponseFrame(byteBuf); case REQUEST_FNF: return createRequestFireAndForgetFrame(byteBuf); case REQUEST_STREAM: return createRequestStreamFrame(byteBuf);