Class ByteBufferContentProvider
java.lang.Object
org.eclipse.jetty.client.util.AbstractTypedContentProvider
org.eclipse.jetty.client.util.ByteBufferContentProvider
- All Implemented Interfaces:
Iterable<ByteBuffer>, ContentProvider, ContentProvider.Typed
A
ContentProvider for ByteBuffers.
The position and limit of the ByteBuffers passed to the constructor are not modified,
and each invocation of the iterator() method returns a slice
of the original ByteBuffer.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ContentProvider
ContentProvider.Typed -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionByteBufferContentProvider(String contentType, ByteBuffer... buffers) ByteBufferContentProvider(ByteBuffer... buffers) -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanWhether this ContentProvider can produce exactly the same content more than once.iterator()Methods inherited from class AbstractTypedContentProvider
getContentTypeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
buffers
-
length
private final int length
-
-
Constructor Details
-
ByteBufferContentProvider
-
ByteBufferContentProvider
-
-
Method Details
-
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:ContentProviderWhether this ContentProvider can produce exactly the same content more than once.
Implementations should return
trueonly if the content can be produced more than once, which means that invocations toIterable.iterator()must return a new, independent, iterator instance over the content.The
HttpClientimplementation 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
-