Class StreamEntityProducer

java.lang.Object
org.aksw.iguana.cc.utils.http.StreamEntityProducer
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

public class StreamEntityProducer extends Object implements org.apache.hc.core5.http.nio.AsyncEntityProducer
An entity producer that produces the entity data from an input stream supplier. The entity data can optionally be sent in chunks. If the entity data is supposed to be sent non-chunked, it is assumed that the query is stored in a ByteArrayListInputStream. The stream supplier should be repeatable, as this producer might be reused multiple times to create the entity data.
  • Constructor Details

    • StreamEntityProducer

      public StreamEntityProducer(Supplier<InputStream> streamSupplier, boolean chunked, String contentType)
      Creates a new entity producer that produces the entity data from the given input stream supplier.
      Parameters:
      streamSupplier - the input stream supplier, should be repeatable
      chunked - whether the entity data should be sent in chunks
  • Method Details

    • 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
    • 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
    • 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
    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder
    • 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