Package io.micronaut.http.body
Class TextPlainHandler
java.lang.Object
io.micronaut.http.body.TextPlainHandler
- All Implemented Interfaces:
MessageBodyHandler<CharSequence>
,MessageBodyReader<CharSequence>
,MessageBodyWriter<CharSequence>
@Produces("text/plain")
@Consumes("text/plain")
@Singleton
public final class TextPlainHandler
extends Object
implements MessageBodyHandler<CharSequence>
Body handler for content type "text/plain".
- Since:
- 4.0.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isReadable
(Argument<CharSequence> type, MediaType mediaType) Is the type readable.read
(Argument<CharSequence> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) Reads an object from the given byte buffer.read
(Argument<CharSequence> type, MediaType mediaType, Headers httpHeaders, InputStream inputStream) Reads an object from the given byte buffer.void
writeTo
(Argument<CharSequence> type, MediaType mediaType, CharSequence object, 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
-
Constructor Details
-
TextPlainHandler
public TextPlainHandler()
-
-
Method Details
-
isReadable
Description copied from interface:MessageBodyReader
Is the type readable.- Specified by:
isReadable
in interfaceMessageBodyReader<CharSequence>
- Parameters:
type
- The typemediaType
- The media type, can benull
- Returns:
- True if is readable
-
writeTo
public void writeTo(Argument<CharSequence> type, MediaType mediaType, CharSequence object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriter
Writes an object to the given output stream.- Specified by:
writeTo
in interfaceMessageBodyWriter<CharSequence>
- Parameters:
type
- The typemediaType
- The media typeobject
- The object to writeoutgoingHeaders
- The HTTP headersoutputStream
- The output stream- Throws:
CodecException
- If an error occurs decoding
-
read
public String read(Argument<CharSequence> 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<CharSequence>
- 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 String read(Argument<CharSequence> 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<CharSequence>
- 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
-