Class ReactiveEntityProducer

java.lang.Object
org.apache.hc.core5.reactive.ReactiveEntityProducer
All Implemented Interfaces:
org.apache.hc.core5.http.EntityDetails, org.apache.hc.core5.http.nio.AsyncDataProducer, org.apache.hc.core5.http.nio.AsyncEntityProducer, org.apache.hc.core5.http.nio.ResourceHolder

@Contract(threading=SAFE) public final class ReactiveEntityProducer extends Object implements org.apache.hc.core5.http.nio.AsyncEntityProducer
An AsyncEntityProducer that subscribes to a Publisher instance, as defined by the Reactive Streams specification.
Since:
5.0
  • Constructor Details

    • ReactiveEntityProducer

      public ReactiveEntityProducer(org.reactivestreams.Publisher<ByteBuffer> publisher, long contentLength, org.apache.hc.core5.http.ContentType contentType, String contentEncoding)
      Creates a new ReactiveEntityProducer with the given parameters.
      Parameters:
      publisher - the publisher of the entity stream.
      contentLength - the length of the entity, or -1 if unknown (implies chunked encoding).
      contentType - the Content-Type of the entity, or null if none.
      contentEncoding - the Content-Encoding of the entity, or null if none.
  • Method Details

    • available

      public int available()
      Specified by:
      available in interface org.apache.hc.core5.http.nio.AsyncDataProducer
    • produce

      public void produce(org.apache.hc.core5.http.nio.DataStreamChannel channel) throws IOException
      Specified by:
      produce in interface org.apache.hc.core5.http.nio.AsyncDataProducer
      Throws:
      IOException
    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder
    • isRepeatable

      public boolean isRepeatable()
      Specified by:
      isRepeatable in interface org.apache.hc.core5.http.nio.AsyncEntityProducer
    • failed

      public void failed(Exception cause)
      Specified by:
      failed in interface org.apache.hc.core5.http.nio.AsyncEntityProducer
    • getContentLength

      public long getContentLength()
      Specified by:
      getContentLength in interface org.apache.hc.core5.http.EntityDetails
    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface org.apache.hc.core5.http.EntityDetails
    • getContentEncoding

      public String getContentEncoding()
      Specified by:
      getContentEncoding in interface org.apache.hc.core5.http.EntityDetails
    • isChunked

      public boolean isChunked()
      Specified by:
      isChunked in interface org.apache.hc.core5.http.EntityDetails
    • getTrailerNames

      public Set<String> getTrailerNames()
      Specified by:
      getTrailerNames in interface org.apache.hc.core5.http.EntityDetails