public interface MediaTypeCodec
| Modifier and Type | Method and Description |
|---|---|
default <T> T |
decode(io.micronaut.core.type.Argument<T> type,
byte[] bytes)
Decode the given type from the given bytes.
|
default <T> T |
decode(io.micronaut.core.type.Argument<T> type,
io.micronaut.core.io.buffer.ByteBuffer<?> buffer)
Decode the given type from the given buffer.
|
<T> T |
decode(io.micronaut.core.type.Argument<T> type,
java.io.InputStream inputStream)
Decode the given type from the given
InputStream. |
default <T> T |
decode(io.micronaut.core.type.Argument<T> type,
java.lang.String data)
Decode the given type from the given bytes.
|
default <T> T |
decode(java.lang.Class<T> type,
byte[] bytes)
Decode the given type from the given bytes.
|
default <T> T |
decode(java.lang.Class<T> type,
io.micronaut.core.io.buffer.ByteBuffer<?> buffer)
Decode the given type from the given buffer.
|
default <T> T |
decode(java.lang.Class<T> type,
java.io.InputStream inputStream)
Decode the given type from the given
InputStream. |
default <T> T |
decode(java.lang.Class<T> type,
java.lang.String data)
Decode the given type from the given bytes.
|
default <T> byte[] |
encode(io.micronaut.core.type.Argument<T> type,
T object)
Encode the given type returning the object as a byte[].
|
default <T,B> io.micronaut.core.io.buffer.ByteBuffer<B> |
encode(io.micronaut.core.type.Argument<T> type,
T object,
io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
Encode the given type returning the object as a
ByteBuffer. |
default <T> void |
encode(io.micronaut.core.type.Argument<T> type,
T object,
java.io.OutputStream outputStream)
Encode the given type to the given
OutputStream. |
<T> byte[] |
encode(T object)
Encode the given type returning the object as a byte[].
|
<T,B> io.micronaut.core.io.buffer.ByteBuffer<B> |
encode(T object,
io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
Encode the given type returning the object as a
ByteBuffer. |
<T> void |
encode(T object,
java.io.OutputStream outputStream)
Encode the given type to the given
OutputStream. |
java.util.Collection<MediaType> |
getMediaTypes() |
default boolean |
supportsType(java.lang.Class<?> type)
Whether the codec can decode the given type.
|
java.util.Collection<MediaType> getMediaTypes()
<T> T decode(io.micronaut.core.type.Argument<T> type,
java.io.InputStream inputStream)
throws CodecException
InputStream.T - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decoded<T> void encode(T object,
java.io.OutputStream outputStream)
throws CodecException
OutputStream.T - The generic typeobject - The object to encodeoutputStream - The output streamCodecException - When the result cannot be encoded<T> byte[] encode(T object)
throws CodecException
T - The generic typeobject - The object to encodeCodecException - When the result cannot be encoded<T,B> io.micronaut.core.io.buffer.ByteBuffer<B> encode(T object,
io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
throws CodecException
ByteBuffer.T - The generic typeB - The buffer typeobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be encodeddefault <T> void encode(@NonNull
io.micronaut.core.type.Argument<T> type,
@NonNull
T object,
@NonNull
java.io.OutputStream outputStream)
throws CodecException
OutputStream.T - The generic typetype - The type including any generics and/or metadata.object - The object to encodeoutputStream - The output streamCodecException - When the result cannot be encoded@NonNull
default <T> byte[] encode(@NonNull
io.micronaut.core.type.Argument<T> type,
T object)
throws CodecException
T - The generic typetype - The type including any generics and/or metadataobject - The object to encodeCodecException - When the result cannot be encoded@NonNull
default <T,B> io.micronaut.core.io.buffer.ByteBuffer<B> encode(@NonNull
io.micronaut.core.type.Argument<T> type,
T object,
@NonNull
io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
throws CodecException
ByteBuffer.T - The generic typeB - The buffer typetype - The type including any generics and/or metadataobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be encodeddefault <T> T decode(java.lang.Class<T> type,
java.io.InputStream inputStream)
throws CodecException
InputStream.T - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decodeddefault <T> T decode(java.lang.Class<T> type,
byte[] bytes)
throws CodecException
T - The decoded typetype - The typebytes - The bytesCodecException - When the result cannot be decodeddefault <T> T decode(io.micronaut.core.type.Argument<T> type,
byte[] bytes)
throws CodecException
T - The decoded typetype - The typebytes - The bytesCodecException - When the result cannot be decodeddefault <T> T decode(java.lang.Class<T> type,
io.micronaut.core.io.buffer.ByteBuffer<?> buffer)
throws CodecException
ByteBuffer instances
should override this method.T - The decoded typetype - The typebuffer - the bufferCodecException - When the result cannot be decodeddefault <T> T decode(io.micronaut.core.type.Argument<T> type,
io.micronaut.core.io.buffer.ByteBuffer<?> buffer)
throws CodecException
ByteBuffer instances
should override this method.T - The decoded typetype - The typebuffer - the bufferCodecException - When the result cannot be decodeddefault <T> T decode(java.lang.Class<T> type,
java.lang.String data)
throws CodecException
T - The decoded typetype - The typedata - The data as a stringCodecException - When the result cannot be decodeddefault <T> T decode(io.micronaut.core.type.Argument<T> type,
java.lang.String data)
throws CodecException
T - The decoded typetype - The typedata - The data as a stringCodecException - When the result cannot be decodeddefault boolean supportsType(java.lang.Class<?> type)
type - The type