Top Description Fields Constructors Methods
io.rsocket.metadata

public Class MimeTypeMetadataCodec

extends Object
Class Inheritance
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, .ByteBufUtil, .CompositeByteBuf, io.netty.util.CharsetUtil, java.util.ArrayList, .List

Provides support for encoding and decoding the per-stream MIME type to use for payload data.

For more on the format of the metadata, see the Stream Data MIME Types extension specification.

Since
1.1.1

Field Summary

Modifier and TypeField and Description
private static final int
private static final byte

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static List<String>

Returns:

the decoded MIME types
decode
(ByteBuf byteBuf)

Decode the per-stream MIME type metadata encoded in the given ByteBuf.

public static ByteBuf

Returns:

the resulting buffer
encode
(ByteBufAllocator
the allocator to create the buffer with
allocator
,
WellKnownMimeType
well-known MIME type to encode
mimeType
)

Encode a WellKnownMimeType into a newly allocated single byte ByteBuf.

public static ByteBuf

Returns:

the resulting buffer
encode
(ByteBufAllocator
the allocator to create the buffer with
allocator
,
String
MIME type to encode
mimeType
)

Encode the given MIME type into a newly allocated ByteBuf.

public static ByteBuf

Returns:

the resulting buffer
encode
(ByteBufAllocator
the allocator to create the buffer with
allocator
,
List<String>
MIME types to encode
mimeTypes
)

Encode multiple MIME types into a newly allocated ByteBuf.

private static ByteBuf
encodeCustomMimeType(ByteBufAllocator allocator, String customMimeType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

STREAM_METADATA_KNOWN_MASKback to summary
private static final int STREAM_METADATA_KNOWN_MASK
STREAM_METADATA_LENGTH_MASKback to summary
private static final byte STREAM_METADATA_LENGTH_MASK

Constructor Detail

MimeTypeMetadataCodecback to summary
private MimeTypeMetadataCodec()

Method Detail

decodeback to summary
public static List<String> decode(ByteBuf byteBuf)

Decode the per-stream MIME type metadata encoded in the given ByteBuf.

Returns:List<String>

the decoded MIME types

encodeback to summary
public static ByteBuf encode(ByteBufAllocator allocator, WellKnownMimeType mimeType)

Encode a WellKnownMimeType into a newly allocated single byte ByteBuf.

Parameters
allocator:ByteBufAllocator

the allocator to create the buffer with

mimeType:WellKnownMimeType

well-known MIME type to encode

Returns:ByteBuf

the resulting buffer

encodeback to summary
public static ByteBuf encode(ByteBufAllocator allocator, String mimeType)

Encode the given MIME type into a newly allocated ByteBuf.

Parameters
allocator:ByteBufAllocator

the allocator to create the buffer with

mimeType:String

MIME type to encode

Returns:ByteBuf

the resulting buffer

encodeback to summary
public static ByteBuf encode(ByteBufAllocator allocator, List<String> mimeTypes)

Encode multiple MIME types into a newly allocated ByteBuf.

Parameters
allocator:ByteBufAllocator

the allocator to create the buffer with

mimeTypes:List<String>

MIME types to encode

Returns:ByteBuf

the resulting buffer

encodeCustomMimeTypeback to summary
private static ByteBuf encodeCustomMimeType(ByteBufAllocator allocator, String customMimeType)