/** * Returns a test instance of {@link MetadataPushFrame}. * * @return a test instance of {@link MetadataPushFrame} */ public static MetadataPushFrame createTestMetadataPushFrame() { return createMetadataPushFrame(DEFAULT, EMPTY_BUFFER); }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param metadata the metadata * @return the {@code METADATA_PUSH} frame * @throws NullPointerException if {@code byteBufAllocator} or {@code metadata} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame( ByteBufAllocator byteBufAllocator, ByteBuf metadata) { Objects.requireNonNull(metadata, "metadata must not be null"); ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, METADATA_PUSH); byteBuf = appendMetadata(byteBuf, metadata); return RECYCLER.get().setByteBuf(byteBuf); }
@Override public @Nullable ByteBuf getUnsafeMetadata() { return getMetadata(OFFSET_METADATA); }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param metadata the metadata * @return the {@code METADATA_PUSH} frame * @throws NullPointerException if {@code byteBufAllocator} or {@code metadata} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame( ByteBufAllocator byteBufAllocator, String metadata) { ByteBuf metadataByteBuf = getUtf8AsByteBufRequired(metadata, "metadata must not be null"); try { return createMetadataPushFrame(byteBufAllocator, metadataByteBuf); } finally { release(metadataByteBuf); } }
@Override public String toString() { return "MetadataPushFrame{" + "metadata=" + mapMetadata(ByteBufUtil::hexDump) + '}'; } }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBuf the {@link ByteBuf} representing the frame * @return the {@code METADATA_PUSH} frame. * @throws NullPointerException if {@code byteBuf} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame(ByteBuf byteBuf) { Objects.requireNonNull(byteBuf, "byteBuf must not be null"); return RECYCLER.get().setByteBuf(byteBuf.retain()); }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param metadata the metadata * @return the {@code METADATA_PUSH} frame * @throws NullPointerException if {@code byteBufAllocator} or {@code metadata} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame( ByteBufAllocator byteBufAllocator, String metadata) { ByteBuf metadataByteBuf = getUtf8AsByteBufRequired(metadata, "metadata must not be null"); try { return createMetadataPushFrame(byteBufAllocator, metadataByteBuf); } finally { release(metadataByteBuf); } }
@Override public String toString() { return "MetadataPushFrame{" + "metadata=" + mapMetadata(ByteBufUtil::hexDump) + '}'; } }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBuf the {@link ByteBuf} representing the frame * @return the {@code METADATA_PUSH} frame. * @throws NullPointerException if {@code byteBuf} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame(ByteBuf byteBuf) { Objects.requireNonNull(byteBuf, "byteBuf must not be null"); return RECYCLER.get().setByteBuf(byteBuf.retain()); }
public static MetadataPushFrame createTestMetadataPushFrame() { return createMetadataPushFrame(DEFAULT, EMPTY_BUFFER); }
/** * Creates the {@code METADATA_PUSH} frame. * * @param byteBufAllocator the {@code ByteBufAllocator} to use * @param metadata the metadata * @return the {@code METADATA_PUSH} frame * @throws NullPointerException if {@code byteBufAllocator} or {@code metadata} is {@code null} */ public static MetadataPushFrame createMetadataPushFrame( ByteBufAllocator byteBufAllocator, ByteBuf metadata) { Objects.requireNonNull(metadata, "metadata must not be null"); ByteBuf byteBuf = createFrameTypeAndFlags(byteBufAllocator, METADATA_PUSH); byteBuf = appendMetadata(byteBuf, metadata); return RECYCLER.get().setByteBuf(byteBuf); }
@Override public @Nullable ByteBuf getUnsafeMetadata() { return getMetadata(OFFSET_METADATA); }
@DisplayName("createMetadataPushFrame throws NullPointerException with null metadata") @Test void createMetadataPushFrameNullMetadata() { assertThatNullPointerException() .isThrownBy(() -> createMetadataPushFrame(DEFAULT, (ByteBuf) null)) .withMessage("metadata must not be null"); } }
return createErrorFrame(byteBuf); case METADATA_PUSH: return createMetadataPushFrame(byteBuf); case RESUME: return createResumeFrame(byteBuf);
return createErrorFrame(byteBuf); case METADATA_PUSH: return createMetadataPushFrame(byteBuf); case RESUME: return createResumeFrame(byteBuf);