Package io.micronaut.http.body
Class CharSequenceBodyWriter
java.lang.Object
io.micronaut.http.body.CharSequenceBodyWriter
- All Implemented Interfaces:
MessageBodyWriter<CharSequence>
,ResponseBodyWriter<CharSequence>
,TypedMessageBodyWriter<CharSequence>
@Singleton
@Internal
public final class CharSequenceBodyWriter
extends Object
implements TypedMessageBodyWriter<CharSequence>, ResponseBodyWriter<CharSequence>
Body writer for
CharSequence
s.- Since:
- 4.0.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetType()
write
(@NonNull ByteBodyFactory bodyFactory, HttpRequest<?> request, MutableHttpResponse<CharSequence> outgoingResponse, Argument<CharSequence> type, MediaType mediaType, CharSequence object) Writes an object as aByteBodyHttpResponse
.writePiece
(@NonNull ByteBodyFactory bodyFactory, @NonNull HttpRequest<?> request, @NonNull HttpResponse<?> response, @NonNull Argument<CharSequence> type, @NonNull MediaType mediaType, CharSequence object) Write a piece of a larger response, e.g.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, writeTo
Methods inherited from interface io.micronaut.http.body.TypedMessageBodyWriter
isWriteable
-
Constructor Details
-
CharSequenceBodyWriter
-
-
Method Details
-
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
-
write
public ByteBodyHttpResponse<?> write(@NonNull @NonNull ByteBodyFactory bodyFactory, HttpRequest<?> request, MutableHttpResponse<CharSequence> outgoingResponse, Argument<CharSequence> type, MediaType mediaType, CharSequence object) throws CodecException Description copied from interface:ResponseBodyWriter
Writes an object as aByteBodyHttpResponse
.- Specified by:
write
in interfaceResponseBodyWriter<CharSequence>
- Parameters:
bodyFactory
- The buffer factoryrequest
- The requestoutgoingResponse
- The responsetype
- The response body typemediaType
- The media typeobject
- The object to write- Returns:
- A
ByteBodyHttpResponse
with the response bytes - Throws:
CodecException
- If an error occurs encoding
-
writePiece
public CloseableByteBody writePiece(@NonNull @NonNull ByteBodyFactory bodyFactory, @NonNull @NonNull HttpRequest<?> request, @NonNull @NonNull HttpResponse<?> response, @NonNull @NonNull Argument<CharSequence> type, @NonNull @NonNull MediaType mediaType, CharSequence object) Description copied from interface:ResponseBodyWriter
Write a piece of a larger response, e.g. when writing a Publisher or a part of a multipart response. In this case, response headers cannot be modified.- Specified by:
writePiece
in interfaceResponseBodyWriter<CharSequence>
- Parameters:
bodyFactory
- The buffer factoryrequest
- The requestresponse
- The response this piece is part oftype
- The type of this piecemediaType
- The media type of this pieceobject
- The piece to write- Returns:
- The response bytes
-
getType
- Specified by:
getType
in interfaceTypedMessageBodyWriter<CharSequence>
- Returns:
- The body type.
-