Class TextPlainHandler

java.lang.Object
io.micronaut.http.body.TextPlainHandler
All Implemented Interfaces:
MessageBodyHandler<CharSequence>, MessageBodyReader<CharSequence>, MessageBodyWriter<CharSequence>

@Produces("text/plain") @Consumes("text/plain") @Singleton public final class TextPlainHandler extends Object implements MessageBodyHandler<CharSequence>
Body handler for content type "text/plain".
Since:
4.0.0
  • Constructor Details

    • TextPlainHandler

      public TextPlainHandler()
  • Method Details

    • isReadable

      public boolean isReadable(io.micronaut.core.type.Argument<CharSequence> type, MediaType mediaType)
      Description copied from interface: MessageBodyReader
      Is the type readable.
      Specified by:
      isReadable in interface MessageBodyReader<CharSequence>
      Parameters:
      type - The type
      mediaType - The media type, can be null
      Returns:
      True if is readable
    • writeTo

      public void writeTo(io.micronaut.core.type.Argument<CharSequence> type, MediaType mediaType, CharSequence object, io.micronaut.core.type.MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException
      Description copied from interface: MessageBodyWriter
      Writes an object to the given output stream.
      Specified by:
      writeTo in interface MessageBodyWriter<CharSequence>
      Parameters:
      type - The type
      mediaType - The media type
      object - The object to write
      outgoingHeaders - The HTTP headers
      outputStream - The output stream
      Throws:
      CodecException - If an error occurs decoding
    • read

      public String read(io.micronaut.core.type.Argument<CharSequence> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, InputStream inputStream) throws CodecException
      Description copied from interface: MessageBodyReader
      Reads an object from the given byte buffer.
      Specified by:
      read in interface MessageBodyReader<CharSequence>
      Parameters:
      type - The type being decoded.
      mediaType - The media type, can be null
      httpHeaders - The HTTP headers
      inputStream - The input stream
      Returns:
      The read object or null
      Throws:
      CodecException - If an error occurs decoding
    • read

      public String read(io.micronaut.core.type.Argument<CharSequence> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer) throws CodecException
      Description copied from interface: MessageBodyReader
      Reads an object from the given byte buffer.
      Specified by:
      read in interface MessageBodyReader<CharSequence>
      Parameters:
      type - The type being decoded.
      mediaType - The media type, can be null
      httpHeaders - The HTTP headers
      byteBuffer - The byte buffer
      Returns:
      The read object or null
      Throws:
      CodecException - If an error occurs decoding