A Content. that is backed by an InputStream.
Data is read from the InputStream into a buffer that is optionally acquired
from a ByteBufferPool, and converted to a Content. that is
returned from read(). If no ByteBufferPool is provided, then
a ByteBufferPool. is used.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBufferPool | |
| private int | |
| private boolean | |
| private Runnable | |
| private Content. | |
| private final InputStream | |
| private final SerializedInvoker | |
| private final AutoLock |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | demand(Runnable
the demand callback to invoke where there is a content chunk available demandCallback)Implements org. Demands to invoke the given demand callback parameter when a chunk of content is available. |
| public void | fail(Throwable
the cause of the failure failure)Implements org. Fails this content source with a |
| private Content. | |
| protected int | |
| public int | |
| private void | |
| public Content. | |
| private void | |
| public void |
| bufferPool | back to summary |
|---|---|
| private final ByteBufferPool bufferPool | |
| bufferSize | back to summary |
|---|---|
| private int bufferSize | |
| closed | back to summary |
|---|---|
| private boolean closed | |
| demandCallback | back to summary |
|---|---|
| private Runnable demandCallback | |
| errorChunk | back to summary |
|---|---|
| private Content. | |
| inputStream | back to summary |
|---|---|
| private final InputStream inputStream | |
| invoker | back to summary |
|---|---|
| private final SerializedInvoker invoker | |
| lock | back to summary |
|---|---|
| private final AutoLock lock | |
| InputStreamContentSource | back to summary |
|---|---|
| public InputStreamContentSource(InputStream inputStream) | |
| InputStreamContentSource | back to summary |
|---|---|
| public InputStreamContentSource(InputStream inputStream, ByteBufferPool bufferPool) | |
| close | back to summary |
|---|---|
| private void close() | |
| demand | back to summary |
|---|---|
| public void demand(Runnable demandCallback) Implements org. Doc from org. Demands to invoke the given demand callback parameter when a chunk of content is available. See how to use this method idiomatically. Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the The demand callback may be invoked spuriously: a subsequent call to Calling this method establishes a pending demand, which is fulfilled when the demand callback is invoked. Calling this method when there is already a pending demand results in an
If the invocation of the demand callback throws an exception, then | |
| fail | back to summary |
|---|---|
| public void fail(Throwable failure) Implements org. Doc from org. Fails this content source with a The failure may be notified to the content reader at a later time, when
the content reader reads a content chunk, via a If Typical failure: the content being aborted by user code, or idle timeouts. If this method has already been called, then it is a no operation. | |
| failure | back to summary |
|---|---|
| private Content. | |
| fillBufferFromInputStream | back to summary |
|---|---|
| protected int fillBufferFromInputStream(InputStream inputStream, byte[] buffer) throws IOException | |
| getBufferSize | back to summary |
|---|---|
| public int getBufferSize() | |
| invokeDemandCallback | back to summary |
|---|---|
| private void invokeDemandCallback() | |
| read | back to summary |
|---|---|
| public Content. Implements org. Doc from org. Reads a chunk of content. See how to use this method idiomatically. The returned chunk could be:
Once a read returns an Once a read returns a The content reader code must ultimately arrange for a call to
Additionally, prior to the ultimate call to Concurrent reads from different threads are not recommended, as they are inherently in a race condition. Reads performed outside the invocation context of a
| |
| runDemandCallback | back to summary |
|---|---|
| private void runDemandCallback(Runnable demandCallback) | |
| setBufferSize | back to summary |
|---|---|
| public void setBufferSize(int bufferSize) | |