Module methanol

Class WritableBodyPublisher

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.channels.WritableByteChannel byteChannel()
      Returns a WritableByteChannel for writing this body's content.
      void close()
      Unless already closed, causes the subscribed (or yet to subscribe) client to be completed after the content written so far has been consumed.
      void closeExceptionally​(java.lang.Throwable exception)
      Unless already closed, causes the subscribed (or yet to subscribe) client to fail with the given exception.
      long contentLength()  
      static WritableBodyPublisher create()
      Returns a new WritableBodyPublisher.
      static WritableBodyPublisher create​(int bufferSize)
      Returns a new WritableBodyPublisher with the given buffer size (number of bytes to buffer before making them available to the HTTP client).
      void flush()
      Makes any buffered content available for consumption by downstream.
      boolean isClosed()
      Returns true if this publisher is closed by either close() or closeExceptionally(java.lang.Throwable).
      java.io.OutputStream outputStream()
      Returns a OutputStream for writing this body's content.
      void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • byteChannel

        public java.nio.channels.WritableByteChannel byteChannel()
        Returns a WritableByteChannel for writing this body's content.
      • outputStream

        public java.io.OutputStream outputStream()
        Returns a OutputStream for writing this body's content.
      • closeExceptionally

        public void closeExceptionally​(java.lang.Throwable exception)
        Unless already closed, causes the subscribed (or yet to subscribe) client to fail with the given exception.
      • close

        public void close()
        Unless already closed, causes the subscribed (or yet to subscribe) client to be completed after the content written so far has been consumed.
        Specified by:
        close in interface java.lang.AutoCloseable
      • flush

        public void flush()
        Makes any buffered content available for consumption by downstream.
        Specified by:
        flush in interface java.io.Flushable
        Throws:
        java.lang.IllegalStateException - if closed
        java.io.UncheckedIOException - if an interruption occurs while waiting
      • contentLength

        public long contentLength()
        Specified by:
        contentLength in interface java.net.http.HttpRequest.BodyPublisher
      • subscribe

        public void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)
        Specified by:
        subscribe in interface java.util.concurrent.Flow.Publisher<java.nio.ByteBuffer>
      • create

        public static WritableBodyPublisher create​(int bufferSize)
        Returns a new WritableBodyPublisher with the given buffer size (number of bytes to buffer before making them available to the HTTP client).