Iterable wrapper around a ByteBuf that exposes metadata entry information at
each decoding step. This is only possible on frame types used to initiate interactions, if the
SETUP metadata mime type was WellKnownMimeType#MESSAGE_RSOCKET_COMPOSITE_METADATA.
This allows efficient incremental decoding of the entries (without moving the source's io.). The buffer is assumed to contain just enough bytes to
represent one or more entries (mime type compressed or not). The decoding stops when the buffer
reaches 0 readable bytes, and fails if it contains bytes but not enough to correctly decode an
entry.
A note on future-proofness: it is possible to come across a compressed mime type that this
implementation doesn't recognize. This is likely to be due to the use of a byte id that is merely
reserved in this implementation, but maps to a WellKnownMimeType in the implementation
that encoded the metadata. This can be detected by detecting that an entry is a ReservedMimeTypeEntry. In this case Entry#getMimeType() will return null. The
encoded id can be retrieved using ReservedMimeTypeEntry#getType(). The byte and content
buffer should be kept around and re-encoded using CompositeMetadataCodec#encodeAndAddMetadata(CompositeByteBuf, ByteBufAllocator, byte, ByteBuf)
in case passing that entry through is required.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | CompositeMetadata.Entry
An entry in the |
| public static class | CompositeMetadata.ExplicitMimeTimeEntry
An |
| public static class | CompositeMetadata.ReservedMimeTypeEntry
An |
| public static class | CompositeMetadata.WellKnownMimeTypeEntry
An |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final ByteBuf |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Iterator | Returns: the composite metadataIteratorImplements java. Iterator that lazily decodes Entry in this composite metadata.
|
| public Stream | Returns: the composite metadata sequentialStreamTurn this |
| retainSlices | back to summary |
|---|---|
| private final boolean retainSlices | |
| source | back to summary |
|---|---|
| private final ByteBuf source | |
| CompositeMetadata | back to summary |
|---|---|
| public CompositeMetadata(ByteBuf source, boolean retainSlices) | |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. An
| |
| stream | back to summary |
|---|---|
| public Stream Turn this
| |
CompositeMetadata.
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuf | Returns: the un-decoded content of theEntryReturns the un-decoded content of the |
| public String | Returns: the MIME type of the entry, if it can be decoded, otherwisenull.Returns the MIME type of the entry, if it can be decoded. |
| getContent | back to summary |
|---|---|
| public ByteBuf getContent() Returns the un-decoded content of the | |
| getMimeType | back to summary |
|---|---|
| public String getMimeType() Returns the MIME type of the entry, if it can be decoded. | |
Entry backed by an explicitly declared MIME type.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuf | getContent()
Implements io. Entry.
|
| public String | getMimeType()
Implements io. |
| content | back to summary |
|---|---|
| private final ByteBuf content | |
| type | back to summary |
|---|---|
| private final String type | |
| ExplicitMimeTimeEntry | back to summary |
|---|---|
| public ExplicitMimeTimeEntry(ByteBuf content, String type) | |
| getContent | back to summary |
|---|---|
| public ByteBuf getContent() Implements io. Doc from io. Returns the un-decoded content of the | |
| getMimeType | back to summary |
|---|---|
| public String getMimeType() Implements io. Doc from io. Returns the MIME type of the entry, if it can be decoded. | |
Entry backed by a WellKnownMimeType entry, but one that is not understood by
this implementation.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuf | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuf | getContent()
Implements io. Entry.
|
| public String | getMimeType()
Implements io. |
| public int | Returns: the reserved, but unknownWellKnownMimeType for this entryReturns the reserved, but unknown |
| content | back to summary |
|---|---|
| private final ByteBuf content | |
| type | back to summary |
|---|---|
| private final int type | |
| ReservedMimeTypeEntry | back to summary |
|---|---|
| public ReservedMimeTypeEntry(ByteBuf content, int type) | |
| getContent | back to summary |
|---|---|
| public ByteBuf getContent() Implements io. Doc from io. Returns the un-decoded content of the | |
| getMimeType | back to summary |
|---|---|
| public String getMimeType() Implements io. Doc from io. Returns the MIME type of the entry, if it can be decoded. Since this entry represents a compressed id that couldn't be decoded, this is
always | |
| getType | back to summary |
|---|---|
| public int getType() Returns the reserved, but unknown
| |
Entry backed by a WellKnownMimeType.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuf | |
| private final WellKnownMimeType |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuf | getContent()
Implements io. Entry.
|
| public String | getMimeType()
Implements io. |
| public WellKnownMimeType |
| content | back to summary |
|---|---|
| private final ByteBuf content | |
| type | back to summary |
|---|---|
| private final WellKnownMimeType type | |
| WellKnownMimeTypeEntry | back to summary |
|---|---|
| public WellKnownMimeTypeEntry(ByteBuf content, WellKnownMimeType type) | |
| getContent | back to summary |
|---|---|
| public ByteBuf getContent() Implements io. Doc from io. Returns the un-decoded content of the | |
| getMimeType | back to summary |
|---|---|
| public String getMimeType() Implements io. Doc from io. Returns the MIME type of the entry, if it can be decoded. | |
| getType | back to summary |
|---|---|
| public WellKnownMimeType getType() Returns the
| |