Class InputStreamContentProvider
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterable<ByteBuffer>,- ContentProvider,- Callback,- Invocable
ContentProvider for an InputStream.
 
 The input stream is read once and therefore fully consumed.
 Invocations to the iterator() method after the first will return an "empty" iterator
 because the stream has been consumed on the first invocation.
 
 However, it is possible for subclasses to override onRead(byte[], int, int) to copy
 the content read from the stream to another location (for example a file), and be able to
 support multiple invocations of iterator(), returning the iterator provided by this
 class on the first invocation, and an iterator on the bytes copied to the other location
 for subsequent invocations.
 
It is possible to specify, at the constructor, a buffer size used to read content from the stream, by default 4096 bytes.
 The InputStream passed to the constructor is by default closed when is it fully
 consumed (or when an exception is thrown while reading it), unless otherwise specified
 to the constructor.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.eclipse.jetty.util.CallbackCallback.Completable, Callback.Completing, Callback.NestedNested classes/interfaces inherited from interface org.eclipse.jetty.client.api.ContentProviderContentProvider.TypedNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.InvocableInvocable.InvocationType, Invocable.ReadyTask, Invocable.Task
- 
Field SummaryFields inherited from interface org.eclipse.jetty.util.thread.Invocable__nonBlocking
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated.InputStreamContentProvider(InputStream stream, int bufferSize) Deprecated.InputStreamContentProvider(InputStream stream, int bufferSize, boolean autoClose) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Deprecated.voidDeprecated.Callback invoked when the operation fails.longDeprecated.iterator()Deprecated.protected ByteBufferonRead(byte[] buffer, int offset, int length) Deprecated.Callback method invoked just after having read from the stream, but before returning the iteration element (aByteBufferto the caller.protected voidonReadFailure(Throwable failure) Deprecated.Callback method invoked when an exception is thrown while reading from the stream.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.CallbackcompleteWith, succeededMethods inherited from interface org.eclipse.jetty.client.api.ContentProviderisReproducibleMethods inherited from interface org.eclipse.jetty.util.thread.InvocablegetInvocationTypeMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
InputStreamContentProviderDeprecated.
- 
InputStreamContentProviderDeprecated.
- 
InputStreamContentProviderDeprecated.
 
- 
- 
Method Details- 
getLengthpublic long getLength()Deprecated.- Specified by:
- getLengthin interface- ContentProvider
- Returns:
- the content length, if known, or -1 if the content length is unknown
 
- 
onReadDeprecated.Callback method invoked just after having read from the stream, but before returning the iteration element (aByteBufferto the caller.Subclasses may override this method to copy the content read from the stream to another location (a file, or in memory if the content is known to fit). - Parameters:
- buffer- the byte array containing the bytes read
- offset- the offset from where bytes should be read
- length- the length of the bytes read
- Returns:
- a ByteBufferwrapping the byte array
 
- 
onReadFailureDeprecated.Callback method invoked when an exception is thrown while reading from the stream.- Parameters:
- failure- the exception thrown while reading from the stream.
 
- 
iteratorDeprecated.- Specified by:
- iteratorin interface- Iterable<ByteBuffer>
 
- 
closepublic void close()Deprecated.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
failedDeprecated.Description copied from interface:CallbackCallback invoked when the operation fails. 
 
- 
InputStreamRequestContentinstead