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 ByteBufferprivate final longThe 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 TypeMethodDescriptionintvoidlongbooleanprotected voidproduceData(org.apache.hc.core5.http.nio.StreamChannel<ByteBuffer> channel) voidMethods 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:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder- Overrides:
releaseResourcesin classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
-
isRepeatable
public boolean isRepeatable() -
getContentLength
public long getContentLength()- Specified by:
getContentLengthin interfaceorg.apache.hc.core5.http.EntityDetails- Overrides:
getContentLengthin classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
-
availableData
public int availableData()- Specified by:
availableDatain 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:
produceDatain classorg.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer- Throws:
IOException
-
failed
-