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
-
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.core.type.Argument<T>getType()booleanisReadable(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)
-
Method Details
-
getType
- Specified by:
getTypein interfaceTypedMessageBodyReader<T>- Returns:
- The body type.
-
isReadable
Description copied from interface:MessageBodyReaderIs the type readable.- Specified by:
isReadablein interfaceMessageBodyReader<T>- Specified by:
isReadablein interfaceTypedMessageBodyReader<T>- Parameters:
type- The typemediaType- The media type, can benull- 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:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
readin interfaceMessageBodyReader<T>- Parameters:
type- The type being decoded.mediaType- The media type, can benullhttpHeaders- The HTTP headersinputStream- 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:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
readin interfaceMessageBodyReader<T>- Parameters:
type- The type being decoded.mediaType- The media type, can benullhttpHeaders- The HTTP headersbyteBuffer- 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:
readChunkedin interfaceChunkedMessageBodyReader<T>
-