Package org.aksw.iguana.cc.utils.http
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 Summary
ConstructorsConstructorDescriptionStreamEntityProducer(Supplier<InputStream> streamSupplier, boolean chunked, String contentType) Creates a new entity producer that produces the entity data from the given input stream supplier. -
Method Summary
Modifier and TypeMethodDescriptionintvoidlongbooleanbooleanvoidproduce(org.apache.hc.core5.http.nio.DataStreamChannel channel) void
-
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 repeatablechunked- whether the entity data should be sent in chunks
-
-
Method Details
-
isRepeatable
public boolean isRepeatable()- Specified by:
isRepeatablein interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
failed
- Specified by:
failedin interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
isChunked
public boolean isChunked()- Specified by:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
- Specified by:
getTrailerNamesin interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentLength
public long getContentLength()- Specified by:
getContentLengthin interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentType
- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails
-
releaseResources
public void releaseResources()- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
available
public int available()- Specified by:
availablein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
- Specified by:
producein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer- Throws:
IOException
-