Class StringBodyReader

java.lang.Object
io.micronaut.http.body.StringBodyReader
All Implemented Interfaces:
ChunkedMessageBodyReader<String>, MessageBodyReader<String>, TypedMessageBodyReader<String>

@Internal @Singleton public final class StringBodyReader extends Object implements TypedMessageBodyReader<String>, ChunkedMessageBodyReader<String>
The body reader for String.
Since:
4.6
  • Method Details

    • getType

      public io.micronaut.core.type.Argument<String> getType()
      Specified by:
      getType in interface TypedMessageBodyReader<String>
      Returns:
      The body type.
    • 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
    • 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
    • readChunked

      public org.reactivestreams.Publisher<String> readChunked(io.micronaut.core.type.Argument<String> 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<String>