Class 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

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer buffer  
      private long length
      The length of the random data to generate.
      private static byte[] RANGE
      The range from which to generate random data.
      private long remaining  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int availableData()  
      void failed​(java.lang.Exception cause)  
      long getContentLength()  
      boolean isRepeatable()  
      protected void produceData​(org.apache.hc.core5.http.nio.StreamChannel<java.nio.ByteBuffer> channel)  
      void releaseResources()  
      • Methods inherited from class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer

        available, getContentEncoding, getContentType, getTrailerNames, isChunked, produce
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 java.nio.ByteBuffer buffer
    • Constructor Detail

      • RandomBinAsyncEntityProducer

        public RandomBinAsyncEntityProducer​(long len)
    • Method Detail

      • 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<java.nio.ByteBuffer> channel)
                            throws java.io.IOException
        Specified by:
        produceData in class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityProducer
        Throws:
        java.io.IOException
      • failed

        public void failed​(java.lang.Exception cause)