Package io.micronaut.http.body
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
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptiongetType()
boolean
isReadable
(Argument<T> type, MediaType mediaType) Is the type readable.Reads an object from the given byte buffer.Reads an object from the given byte buffer.readChunked
(Argument<T> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input)
-
Method Details
-
getType
- Specified by:
getType
in interfaceTypedMessageBodyReader<T>
- Returns:
- The body type.
-
isReadable
Description copied from interface:MessageBodyReader
Is the type readable.- Specified by:
isReadable
in interfaceMessageBodyReader<T>
- Specified by:
isReadable
in interfaceTypedMessageBodyReader<T>
- Parameters:
type
- The typemediaType
- The media type, can benull
- Returns:
- True if is readable
-
read
public T read(Argument<T> type, MediaType mediaType, Headers httpHeaders, InputStream inputStream) throws CodecException Description copied from interface:MessageBodyReader
Reads an object from the given byte buffer.- Specified by:
read
in interfaceMessageBodyReader<T>
- Parameters:
type
- The type being decoded.mediaType
- The media type, can benull
httpHeaders
- The HTTP headersinputStream
- The input stream- Returns:
- The read object or
null
- Throws:
CodecException
- If an error occurs decoding
-
read
public T read(Argument<T> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) throws CodecException Description copied from interface:MessageBodyReader
Reads an object from the given byte buffer.- Specified by:
read
in interfaceMessageBodyReader<T>
- Parameters:
type
- The type being decoded.mediaType
- The media type, can benull
httpHeaders
- The HTTP headersbyteBuffer
- The byte buffer- Returns:
- The read object or
null
- Throws:
CodecException
- If an error occurs decoding
-
readChunked
public Publisher<T> readChunked(Argument<T> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input) - Specified by:
readChunked
in interfaceChunkedMessageBodyReader<T>
-