Class ByteBufferContentProvider

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer[] buffers  
      private int length  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getLength()  
      boolean isReproducible()
      Whether this ContentProvider can produce exactly the same content more than once.
      java.util.Iterator<java.nio.ByteBuffer> iterator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • buffers

        private final java.nio.ByteBuffer[] buffers
      • length

        private final int length
    • Constructor Detail

      • ByteBufferContentProvider

        public ByteBufferContentProvider​(java.nio.ByteBuffer... buffers)
      • ByteBufferContentProvider

        public ByteBufferContentProvider​(java.lang.String contentType,
                                         java.nio.ByteBuffer... buffers)
    • Method Detail

      • getLength

        public long getLength()
        Returns:
        the content length, if known, or -1 if the content length is unknown
      • isReproducible

        public boolean isReproducible()
        Description copied from interface: ContentProvider

        Whether this ContentProvider can produce exactly the same content more than once.

        Implementations should return true only if the content can be produced more than once, which means that invocations to Iterable.iterator() must return a new, independent, iterator instance over the content.

        The HttpClient implementation may use this method in particular cases where it detects that it is safe to retry a request that failed.

        Returns:
        whether the content can be produced more than once
      • iterator

        public java.util.Iterator<java.nio.ByteBuffer> iterator()