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 Details

    • RANGE

      private static final byte[] RANGE
      The range from which to generate random data.
    • length

      private final long length
      The length of the random data to generate.
    • remaining

      private long remaining
    • buffer

      private final ByteBuffer buffer
  • Constructor Details

    • RandomBinAsyncEntityProducer

      public RandomBinAsyncEntityProducer(long len)
  • Method Details

    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder
      Overrides:
      releaseResources in class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
    • isRepeatable

      public boolean isRepeatable()
    • getContentLength

      public long getContentLength()
      Specified by:
      getContentLength in interface org.apache.hc.core5.http.EntityDetails
      Overrides:
      getContentLength in class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
    • availableData

      public int availableData()
      Specified by:
      availableData in class org.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 class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
      Throws:
      IOException
    • failed

      public void failed(Exception cause)