@Singleton public class TextPlainCodec extends java.lang.Object implements MediaTypeCodec
MediaType.TEXT_PLAIN.| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CONFIGURATION_QUALIFIER  | 
| Constructor and Description | 
|---|
TextPlainCodec(java.nio.charset.Charset defaultCharset)  | 
TextPlainCodec(java.util.Optional<java.nio.charset.Charset> defaultCharset,
              CodecConfiguration codecConfiguration)  | 
| Modifier and Type | Method and Description | 
|---|---|
<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. | 
<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()  | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, decode, decode, decode, decode, decode, supportsTypepublic static final java.lang.String CONFIGURATION_QUALIFIER
@Inject public TextPlainCodec(@Value(value="${micronaut.application.default-charset}") java.util.Optional<java.nio.charset.Charset> defaultCharset, @Named(value="text") @Nullable CodecConfiguration codecConfiguration)
defaultCharset - The default charset used for serialization and deserializationcodecConfiguration - The configuration for the codecpublic TextPlainCodec(java.nio.charset.Charset defaultCharset)
defaultCharset - The default charset used for serialization and deserializationpublic java.util.Collection<MediaType> getMediaTypes()
getMediaTypes in interface MediaTypeCodecpublic <T> T decode(Argument<T> type, ByteBuffer<?> buffer) throws CodecException
MediaTypeCodecByteBuffer instances
 should override this method.decode in interface MediaTypeCodecT - The decoded typetype - The typebuffer - the bufferCodecException - When the result cannot be decodedpublic <T> T decode(Argument<T> type, java.io.InputStream inputStream) throws CodecException
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decodedpublic <T> void encode(T object,
                       java.io.OutputStream outputStream)
                throws CodecException
MediaTypeCodecOutputStream.encode in interface MediaTypeCodecT - The generic typeobject - The object to encodeoutputStream - The output streamCodecException - When the result cannot be encodedpublic <T> byte[] encode(T object)
                  throws CodecException
MediaTypeCodecencode in interface MediaTypeCodecT - The generic typeobject - The object to encodeCodecException - When the result cannot be encodedpublic <T,B> ByteBuffer<B> encode(T object, ByteBufferFactory<?,B> allocator) throws CodecException
MediaTypeCodecByteBuffer.encode in interface MediaTypeCodecT - The generic typeB - The buffer typeobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be encoded