Class TextPlainCodec

java.lang.Object
io.micronaut.runtime.http.codec.TextPlainCodec
All Implemented Interfaces:
MediaTypeCodec

@Singleton @Deprecated(forRemoval=true, since="4.7") public class TextPlainCodec extends Object implements MediaTypeCodec
Deprecated, for removal: This API element is subject to removal in a future version.
Replaced with message body writers / readers API
A codec that handles MediaType.TEXT_PLAIN.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextPlainCodec(Charset defaultCharset, io.micronaut.core.convert.ConversionService conversionService)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    TextPlainCodec(Optional<Charset> defaultCharset, @Nullable CodecConfiguration codecConfiguration, io.micronaut.core.convert.ConversionService conversionService)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    decode(io.micronaut.core.type.Argument<T> type, byte[] bytes)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Decode the given type from the given bytes.
    <T> T
    decode(io.micronaut.core.type.Argument<T> type, io.micronaut.core.io.buffer.ByteBuffer<?> buffer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Decode the given type from the given buffer.
    <T> T
    decode(io.micronaut.core.type.Argument<T> type, InputStream inputStream)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Decode the given type from the given InputStream.
    <T> byte[]
    encode(T object)
    Deprecated, for removal: This API element is subject to removal in a future version.
    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)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Encode the given type returning the object as a ByteBuffer.
    <T> void
    encode(T object, OutputStream outputStream)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Encode the given type to the given OutputStream.
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.http.codec.MediaTypeCodec

    decode, decode, decode, decode, decode, encode, encode, encode, supportsType
  • Field Details

    • CONFIGURATION_QUALIFIER

      public static final String CONFIGURATION_QUALIFIER
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
  • Constructor Details

    • TextPlainCodec

      @Inject public TextPlainCodec(@Value("${micronaut.application.default-charset}") Optional<Charset> defaultCharset, @Named("text") @Nullable @Nullable CodecConfiguration codecConfiguration, io.micronaut.core.convert.ConversionService conversionService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      defaultCharset - The default charset used for serialization and deserialization
      codecConfiguration - The configuration for the codec
      conversionService - The conversion service
    • TextPlainCodec

      public TextPlainCodec(Charset defaultCharset, io.micronaut.core.convert.ConversionService conversionService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      defaultCharset - The default charset used for serialization and deserialization
      conversionService - The conversion service
  • Method Details

    • getMediaTypes

      public Collection<MediaType> getMediaTypes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getMediaTypes in interface MediaTypeCodec
      Returns:
      The media type of the codec
    • decode

      public <T> T decode(io.micronaut.core.type.Argument<T> type, io.micronaut.core.io.buffer.ByteBuffer<?> buffer) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given buffer. Implementations optimized to handle ByteBuffer instances should override this method.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The decoded type
      Parameters:
      type - The type
      buffer - the buffer
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • decode

      public <T> T decode(io.micronaut.core.type.Argument<T> type, byte[] bytes) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given bytes.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The decoded type
      Parameters:
      type - The type
      bytes - The bytes
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • decode

      public <T> T decode(io.micronaut.core.type.Argument<T> type, InputStream inputStream) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given InputStream.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      inputStream - The input stream
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • encode

      public <T> void encode(T object, OutputStream outputStream) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Encode the given type to the given OutputStream.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      object - The object to encode
      outputStream - The output stream
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T> byte[] encode(T object) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a byte[].
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      object - The object to encode
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T, B> io.micronaut.core.io.buffer.ByteBuffer<B> encode(T object, io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator) throws CodecException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a ByteBuffer.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      B - The buffer type
      Parameters:
      object - The object to encode
      allocator - The allocator
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded