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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    true iff this closure can do a blocking read on the object it receives.
    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)
    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, isWriteable, writeTo

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Constructor Details

    • WritableBodyWriter

      public WritableBodyWriter()
  • Method Details

    • isBlocking

      public boolean isBlocking()
      Description copied from interface: MessageBodyWriter
      true iff this closure can do a blocking read on the object it receives. For example, if this closure writes from an InputStream, that operation may be blocking and this method returns true.
      Note that even when this is false, MessageBodyWriter.writeTo(Argument, MediaType, Object, MutableHeaders, OutputStream) may still block because the OutputStream that is passed as the write destination may still block.
      Specified by:
      isBlocking in interface MessageBodyWriter<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: MessageBodyWriter
      Writes an object to the given output stream.
      Specified by:
      writeTo in interface MessageBodyWriter<io.micronaut.core.io.Writable>
      Parameters:
      type - The type
      mediaType - The media type
      object - The object to write
      outgoingHeaders - The HTTP headers
      outputStream - The output stream
      Throws:
      CodecException - If an error occurs decoding