public interface MediaTypeCodec
Modifier and Type | Method and Description |
---|---|
default <T> T |
decode(Argument<T> type,
byte[] bytes)
Decode the given type from the given bytes.
|
default <T> T |
decode(Argument<T> type,
ByteBuffer<?> buffer)
Decode the given type from the given buffer.
|
<T> T |
decode(Argument<T> type,
java.io.InputStream inputStream)
Decode the given type from the given
InputStream . |
default <T> T |
decode(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,
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.
|
<T> byte[] |
encode(T object)
Encode the given type returning the object as a byte[].
|
<T,B> ByteBuffer<B> |
encode(T object,
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(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> ByteBuffer<B> encode(T object, 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> 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(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, 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(Argument<T> type, 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(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