Class BytesContentProvider
java.lang.Object
org.eclipse.jetty.client.util.AbstractTypedContentProvider
org.eclipse.jetty.client.util.BytesContentProvider
- All Implemented Interfaces:
Iterable<ByteBuffer>, ContentProvider, ContentProvider.Typed
- Direct Known Subclasses:
StringContentProvider
A
ContentProvider for byte arrays.-
Nested Class Summary
Nested classes/interfaces inherited from interface ContentProvider
ContentProvider.Typed -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBytesContentProvider(byte[]... bytes) BytesContentProvider(String contentType, byte[]... bytes) -
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
-
bytes
private final byte[][] bytes -
length
private final long length
-
-
Constructor Details
-
BytesContentProvider
public BytesContentProvider(byte[]... bytes) -
BytesContentProvider
-
-
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
-