public interface MetadataFrame extends Frame
Disposable.Composite, Disposable.SwapFRAME_TYPE_SHIFT| Modifier and Type | Method and Description |
|---|---|
default Optional<String> |
getMetadataAsUtf8()
Returns the metadata as a UTF-8
String. |
default Optional<Integer> |
getMetadataLength()
Returns the length of the metadata in the frame.
|
ByteBuf |
getUnsafeMetadata()
Returns the metadata directly.
|
default String |
getUnsafeMetadataAsUtf8()
Returns the metadata as a UTF-8
String. |
default Integer |
getUnsafeMetadataLength()
Returns the length of the metadata in the frame directly.
|
default <T> Optional<T> |
mapMetadata(Function<ByteBuf,T> function)
Exposes the metadata for mapping to a different type.
|
consumeFrame, getFrameType, getUnsafeFrame, mapFramedispose, isDisposeddefault Optional<String> getMetadataAsUtf8()
String. If the Metadata flag is not set, returns Optional.empty().Stringdefault Optional<Integer> getMetadataLength()
Optional.empty().@Nullable ByteBuf getUnsafeMetadata()
null.
Note: this metadata will be outside of the Frame's lifecycle and may be
released at any time. It is highly recommended that you ByteBuf.retain() the metadata
if you store it.
null if the Metadata flag is not setgetMetadataAsUtf8(),
mapMetadata(Function)@Nullable default String getUnsafeMetadataAsUtf8()
String. If the Metadata flag is not set, returns null.String or null if the Metadata flag is not set.getMetadataAsUtf8()@Nullable default Integer getUnsafeMetadataLength()
null.null if the Metadata flag is
not setgetMetadataLength()default <T> Optional<T> mapMetadata(Function<ByteBuf,T> function)
Optional.empty().T - the different typefunction - the function to transform the metadata to a different typeNullPointerException - if function is null