Class TextPlainHandler

java.lang.Object
io.micronaut.http.body.TextPlainHandler
All Implemented Interfaces:
io.micronaut.core.order.Ordered, MessageBodyHandler<String>, MessageBodyReader<String>, MessageBodyWriter<String>

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

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isReadable(io.micronaut.core.type.Argument<String> type, MediaType mediaType)
    Is the type readable.
    read(io.micronaut.core.type.Argument<String> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer)
    Reads an object from the given byte buffer.
    read(io.micronaut.core.type.Argument<String> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, InputStream inputStream)
    Reads an object from the given byte buffer.
    void
    writeTo(io.micronaut.core.type.Argument<String> type, MediaType mediaType, String object, io.micronaut.core.type.MutableHeaders outgoingHeaders, OutputStream outputStream)
    Writes an object to the given output stream.

    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.body.MessageBodyWriter

    createSpecific, isBlocking, isWriteable, writeTo

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Constructor Details

    • TextPlainHandler

      public TextPlainHandler()
  • Method Details

    • isReadable

      public boolean isReadable(io.micronaut.core.type.Argument<String> type, MediaType mediaType)
      Description copied from interface: MessageBodyReader
      Is the type readable.
      Specified by:
      isReadable in interface MessageBodyReader<String>
      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<String> type, MediaType mediaType, String 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<String>
      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<String> 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<String>
      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<String> 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<String>
      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