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
ConstructorDescriptionStreamEntityProducer
(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 TypeMethodDescriptionint
void
long
boolean
boolean
void
produce
(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:
isRepeatable
in interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
failed
- Specified by:
failed
in interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
isChunked
public boolean isChunked()- Specified by:
isChunked
in interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
- Specified by:
getTrailerNames
in interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentLength
public long getContentLength()- Specified by:
getContentLength
in interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentType
- Specified by:
getContentType
in interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
- Specified by:
getContentEncoding
in interfaceorg.apache.hc.core5.http.EntityDetails
-
releaseResources
public void releaseResources()- Specified by:
releaseResources
in interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
available
public int available()- Specified by:
available
in interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
- Specified by:
produce
in interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
- Throws:
IOException
-