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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReadable(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.voidwriteTo(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, waitMethods inherited from interface io.micronaut.http.body.MessageBodyWriter
createSpecific, isBlocking, isWriteable, writeTo
-
Constructor Details
-
TextPlainHandler
public TextPlainHandler()
-
-
Method Details
-
isReadable
Description copied from interface:MessageBodyReaderIs the type readable.- Specified by:
isReadablein 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:MessageBodyWriterWrites an object to the given output stream.- Specified by:
writeToin 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:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
readin interfaceMessageBodyReader<CharSequence>- 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 String read(Argument<CharSequence> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) throws CodecException Description copied from interface:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
readin interfaceMessageBodyReader<CharSequence>- 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
-