Package io.micronaut.http.body
Class WritableBodyWriter
java.lang.Object
io.micronaut.http.body.WritableBodyWriter
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,MessageBodyWriter<io.micronaut.core.io.Writable>
@Singleton
public final class WritableBodyWriter
extends Object
implements MessageBodyWriter<io.micronaut.core.io.Writable>
Body writer for
Writables.- Since:
- 4.0.0
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantrueiff this closure can do a blocking read on the object it receives.voidwriteTo(io.micronaut.core.type.Argument<io.micronaut.core.io.Writable> type, MediaType mediaType, io.micronaut.core.io.Writable object, io.micronaut.core.type.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, isWriteable, writeToMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
WritableBodyWriter
public WritableBodyWriter()
-
-
Method Details
-
isBlocking
public boolean isBlocking()Description copied from interface:MessageBodyWritertrueiff this closure can do a blocking read on the object it receives. For example, if this closure writes from anInputStream, that operation may be blocking and this method returnstrue.
Note that even when this isfalse,MessageBodyWriter.writeTo(Argument, MediaType, Object, MutableHeaders, OutputStream)may still block because theOutputStreamthat is passed as the write destination may still block.- Specified by:
isBlockingin interfaceMessageBodyWriter<io.micronaut.core.io.Writable>- Returns:
- Whether this writer may block
-
writeTo
public void writeTo(io.micronaut.core.type.Argument<io.micronaut.core.io.Writable> type, MediaType mediaType, io.micronaut.core.io.Writable object, io.micronaut.core.type.MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriterWrites an object to the given output stream.- Specified by:
writeToin interfaceMessageBodyWriter<io.micronaut.core.io.Writable>- Parameters:
type- The typemediaType- The media typeobject- The object to writeoutgoingHeaders- The HTTP headersoutputStream- The output stream- Throws:
CodecException- If an error occurs decoding
-