ByteBuf. This is intended for low-level efficient manipulation of such buffers. See CompositeMetadata for an Iterator-like approach to decoding entries.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final byte |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static int | |
| public static ByteBuf[] | Returns: aByteBuf array of length 2 containing the mime header buffer
slice and the content buffer slice, or one of the
zero-length error constant arraysthe source compositeMetadata, int ByteBuf that originally contains one or more
metadata entriesthe entryIndex, boolean retainSlices)ByteBuf#readerIndex() to start decoding from. original reader
index is kept on the source bufferDecode the next metadata entry (a mime header + content pair of |
| public static byte | Returns: the compressed mime id, between 0 and 127, or a negative id if the input is invalidthe buffer that should next contain the compressed mime id byte mimeBuffer)Decode a The buffer must have exactly one readable byte, which is assumed to have been tested for
mime id encoding via the |
| public static CharSequence | Returns: the decoded custom mime type, as aCharSequence, or null if the input is
invalidthe mime header flyweightMimeBuffer)ByteBuf that contains length + custom mime
typeDecode a |
| public static void | encodeAndAddMetadata(CompositeByteBuf
the buffer that will hold all composite metadata information. compositeMetaData, ByteBufAllocator the allocator, String ByteBufAllocator to use to create intermediate buffers as needed.the custom mime type to encode. customMimeType, ByteBuf the metadata value to encode. metadata)Encode a new sub-metadata information into a composite metadata |
| public static void | encodeAndAddMetadata(CompositeByteBuf
the buffer that will hold all composite metadata information. compositeMetaData, ByteBufAllocator the allocator, WellKnownMimeType ByteBufAllocator to use to create intermediate buffers as needed.the knownMimeType, ByteBuf WellKnownMimeType to encode.the metadata value to encode. metadata)Encode a new sub-metadata information into a composite metadata |
| pack-priv static void | encodeAndAddMetadata(CompositeByteBuf
the buffer that will hold all composite metadata information. compositeMetaData, ByteBufAllocator the allocator, byte ByteBufAllocator to use to create intermediate buffers as needed.the id of the unknownCompressedMimeType, ByteBuf WellKnownMimeType#UNKNOWN_RESERVED_MIME_TYPE to encode.the metadata value to encode. metadata)Encode a new sub-metadata information into a composite metadata |
| public static void | encodeAndAddMetadataWithCompression(CompositeByteBuf
the buffer that will hold all composite metadata information. compositeMetaData, ByteBufAllocator the allocator, String ByteBufAllocator to use to create intermediate buffers as needed.the mime type to encode, as a mimeType, ByteBuf String. well known mime types are
compressed.the metadata value to encode. metadata)Encode a new sub-metadata information into a composite metadata |
| pack-priv static ByteBuf | Returns: the encoded mime and metadata length informationthe allocator, String ByteBufAllocator to use to create the buffer.a custom mime type to encode. customMime, int the metadata length to append to the buffer as an unsigned 24 bits
integer. metadataLength)Encode a custom mime type and a metadata value length into a newly allocated |
| pack-priv static ByteBuf | Returns: the encoded mime and metadata length informationthe allocator, byte ByteBufAllocator to use to create the buffer.a byte identifier of a mimeType, int WellKnownMimeType to encode.the metadata length to append to the buffer as an unsigned 24 bits
integer. metadataLength)Encode a |
| public static boolean | |
| public static boolean | Returns: whether the header represents a well-known MIME typethe header to inspect header)Returns whether the header represents a well-known MIME type. |
| STREAM_METADATA_KNOWN_MASK | back to summary |
|---|---|
| pack-priv static final int STREAM_METADATA_KNOWN_MASK | |
| STREAM_METADATA_LENGTH_MASK | back to summary |
|---|---|
| pack-priv static final byte STREAM_METADATA_LENGTH_MASK | |
| CompositeMetadataCodec | back to summary |
|---|---|
| private CompositeMetadataCodec() | |
| computeNextEntryIndex | back to summary |
|---|---|
| public static int computeNextEntryIndex(int currentEntryIndex, ByteBuf headerSlice, ByteBuf contentSlice) | |
| decodeMimeAndContentBuffersSlices | back to summary |
|---|---|
| public static ByteBuf[] decodeMimeAndContentBuffersSlices(ByteBuf compositeMetadata, int entryIndex, boolean retainSlices) Decode the next metadata entry (a mime header + content pair of The header buffer is either:
| |
| decodeMimeIdFromMimeBuffer | back to summary |
|---|---|
| public static byte decodeMimeIdFromMimeBuffer(ByteBuf mimeBuffer) Decode a The buffer must have exactly one readable byte, which is assumed to have been tested for
mime id encoding via the If there is no readable byte, the negative identifier of
| |
| decodeMimeTypeFromMimeBuffer | back to summary |
|---|---|
| public static CharSequence decodeMimeTypeFromMimeBuffer(ByteBuf flyweightMimeBuffer) Decode a The buffer must at least have two readable bytes, which distinguishes it from the If the mime header buffer is less than 2 bytes long, returns
| |
| encodeAndAddMetadata | back to summary |
|---|---|
| public static void encodeAndAddMetadata(CompositeByteBuf compositeMetaData, ByteBufAllocator allocator, String customMimeType, ByteBuf metadata) Encode a new sub-metadata information into a composite metadata
| |
| encodeAndAddMetadata | back to summary |
|---|---|
| public static void encodeAndAddMetadata(CompositeByteBuf compositeMetaData, ByteBufAllocator allocator, WellKnownMimeType knownMimeType, ByteBuf metadata) Encode a new sub-metadata information into a composite metadata
| |
| encodeAndAddMetadata | back to summary |
|---|---|
| pack-priv static void encodeAndAddMetadata(CompositeByteBuf compositeMetaData, ByteBufAllocator allocator, byte unknownCompressedMimeType, ByteBuf metadata) Encode a new sub-metadata information into a composite metadata
| |
| encodeAndAddMetadataWithCompression | back to summary |
|---|---|
| public static void encodeAndAddMetadataWithCompression(CompositeByteBuf compositeMetaData, ByteBufAllocator allocator, String mimeType, ByteBuf metadata) Encode a new sub-metadata information into a composite metadata Prefer using
| |
| encodeMetadataHeader | back to summary |
|---|---|
| pack-priv static ByteBuf encodeMetadataHeader(ByteBufAllocator allocator, String customMime, int metadataLength) Encode a custom mime type and a metadata value length into a newly allocated This larger representation encodes the mime type representation's length on a single byte, then the representation itself, then the unsigned metadata value length on 3 additional bytes.
| |
| encodeMetadataHeader | back to summary |
|---|---|
| pack-priv static ByteBuf encodeMetadataHeader(ByteBufAllocator allocator, byte mimeType, int metadataLength) Encode a This compact representation encodes the mime type via its ID on a single byte, and the unsigned value length on 3 additional bytes.
| |
| hasEntry | back to summary |
|---|---|
| public static boolean hasEntry(ByteBuf compositeMetadata, int entryIndex) Returns whether there is another entry available at a given index
| |
| isWellKnownMimeType | back to summary |
|---|---|
| public static boolean isWellKnownMimeType(ByteBuf header) Returns whether the header represents a well-known MIME type.
| |