Class TextPlainObjectBodyReader<T>

java.lang.Object
io.micronaut.http.body.TextPlainObjectBodyReader<T>
Type Parameters:
T - The body type
All Implemented Interfaces:
ChunkedMessageBodyReader<T>, MessageBodyReader<T>, TypedMessageBodyReader<T>

@Produces("text/plain") @Consumes("text/plain") @Singleton @Internal public final class TextPlainObjectBodyReader<T> extends Object implements TypedMessageBodyReader<T>, ChunkedMessageBodyReader<T>
The body reader that reads a text/plain string converting it into the argument type.
Since:
4.6
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.core.type.Argument<T>
     
    boolean
    isReadable(io.micronaut.core.type.Argument<T> type, MediaType mediaType)
    Is the type readable.
    read(io.micronaut.core.type.Argument<T> 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<T> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, InputStream inputStream)
    Reads an object from the given byte buffer.
    org.reactivestreams.Publisher<T>
    readChunked(io.micronaut.core.type.Argument<T> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, org.reactivestreams.Publisher<io.micronaut.core.io.buffer.ByteBuffer<?>> input)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getType

      public io.micronaut.core.type.Argument<T> getType()
      Specified by:
      getType in interface TypedMessageBodyReader<T>
      Returns:
      The body type.
    • isReadable

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

      public T read(io.micronaut.core.type.Argument<T> 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<T>
      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 T read(io.micronaut.core.type.Argument<T> 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<T>
      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
    • readChunked

      public org.reactivestreams.Publisher<T> readChunked(io.micronaut.core.type.Argument<T> type, MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, org.reactivestreams.Publisher<io.micronaut.core.io.buffer.ByteBuffer<?>> input)
      Specified by:
      readChunked in interface ChunkedMessageBodyReader<T>