Class AsyncRandomHandler.RandomBinAsyncEntityProducer
java.lang.Object
org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
org.apache.hc.client5.testing.async.AsyncRandomHandler.RandomBinAsyncEntityProducer
- 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
- Enclosing class:
AsyncRandomHandler
public static class AsyncRandomHandler.RandomBinAsyncEntityProducer
extends org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
An entity that generates random data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBuffer
private final long
The length of the random data to generate.private static final byte[]
The range from which to generate random data.private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
void
long
boolean
protected void
produceData
(org.apache.hc.core5.http.nio.StreamChannel<ByteBuffer> channel) void
Methods inherited from class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
available, getContentEncoding, getContentType, getTrailerNames, isChunked, produce
-
Field Details
-
RANGE
private static final byte[] RANGEThe range from which to generate random data. -
length
private final long lengthThe length of the random data to generate. -
remaining
private long remaining -
buffer
-
-
Constructor Details
-
RandomBinAsyncEntityProducer
public RandomBinAsyncEntityProducer(long len)
-
-
Method Details
-
releaseResources
public void releaseResources()- Specified by:
releaseResources
in interfaceorg.apache.hc.core5.http.nio.ResourceHolder
- Overrides:
releaseResources
in classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
-
isRepeatable
public boolean isRepeatable() -
getContentLength
public long getContentLength()- Specified by:
getContentLength
in interfaceorg.apache.hc.core5.http.EntityDetails
- Overrides:
getContentLength
in classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
-
availableData
public int availableData()- Specified by:
availableData
in classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
-
produceData
protected void produceData(org.apache.hc.core5.http.nio.StreamChannel<ByteBuffer> channel) throws IOException - Specified by:
produceData
in classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
- Throws:
IOException
-
failed
-