Package org.eclipse.jetty.client.util
Class ByteBufferContentProvider
- java.lang.Object
-
- org.eclipse.jetty.client.util.AbstractTypedContentProvider
-
- org.eclipse.jetty.client.util.ByteBufferContentProvider
-
- All Implemented Interfaces:
java.lang.Iterable<java.nio.ByteBuffer>,ContentProvider,ContentProvider.Typed
public class ByteBufferContentProvider extends AbstractTypedContentProvider
AContentProviderforByteBuffers.The position and limit of the
ByteBuffers passed to the constructor are not modified, and each invocation of theiterator()method returns asliceof the originalByteBuffer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.ContentProvider
ContentProvider.Typed
-
-
Constructor Summary
Constructors Constructor Description ByteBufferContentProvider(java.lang.String contentType, java.nio.ByteBuffer... buffers)ByteBufferContentProvider(java.nio.ByteBuffer... buffers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetLength()booleanisReproducible()Whether this ContentProvider can produce exactly the same content more than once.java.util.Iterator<java.nio.ByteBuffer>iterator()-
Methods inherited from class org.eclipse.jetty.client.util.AbstractTypedContentProvider
getContentType
-
-
-
-
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: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
public java.util.Iterator<java.nio.ByteBuffer> iterator()
-
-