Class InputStreamContentProvider
- java.lang.Object
-
- org.eclipse.jetty.client.util.InputStreamContentProvider
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.nio.ByteBuffer>
,ContentProvider
,Callback
,Invocable
@Deprecated(since="2021-05-27") public class InputStreamContentProvider extends java.lang.Object implements ContentProvider, Callback, java.io.Closeable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.AContentProvider
for anInputStream
.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 ofiterator()
, 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 theconstructor
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.ContentProvider
ContentProvider.Typed
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Constructor Description InputStreamContentProvider(java.io.InputStream stream)
Deprecated.InputStreamContentProvider(java.io.InputStream stream, int bufferSize)
Deprecated.InputStreamContentProvider(java.io.InputStream stream, int bufferSize, boolean autoClose)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.void
failed(java.lang.Throwable failure)
Deprecated.Callback invoked when the operation fails.long
getLength()
Deprecated.java.util.Iterator<java.nio.ByteBuffer>
iterator()
Deprecated.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.client.api.ContentProvider
isReproducible
-
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
-
-
-
Constructor Detail
-
InputStreamContentProvider
public InputStreamContentProvider(java.io.InputStream stream)
Deprecated.
-
InputStreamContentProvider
public InputStreamContentProvider(java.io.InputStream stream, int bufferSize)
Deprecated.
-
InputStreamContentProvider
public InputStreamContentProvider(java.io.InputStream stream, int bufferSize, boolean autoClose)
Deprecated.
-
-
Method Detail
-
getLength
public long getLength()
Deprecated.- Specified by:
getLength
in interfaceContentProvider
- Returns:
- the content length, if known, or -1 if the content length is unknown
-
iterator
public java.util.Iterator<java.nio.ByteBuffer> iterator()
Deprecated.- Specified by:
iterator
in interfacejava.lang.Iterable<java.nio.ByteBuffer>
-
close
public void close()
Deprecated.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-