A Content. that is also a Content..
Content written to the Content. is converted to a Content.
and made available to calls to the read() method. If necessary, any
Runnable passed to the demand(Runnable) method is invoked once
content is written to the Content..
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final AsyncContent. | |
| private final Queue | |
| private Runnable | |
| private final SerializedInvoker | |
| private long | |
| private final AutoLock. | |
| private Content. | |
| private boolean | |
| private static final int | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| public int | |
| 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 |
| public void | fail(Throwable
A failure. failure, boolean true if the failure is persistent, false if the failure is transient. last)Overrides default org. Fails this content source with a |
| public void | |
| public long | |
| private void | |
| public boolean | |
| private void | |
| public Content. | |
| private void | |
| public void | write(boolean
whether the ByteBuffer is the last to write last, ByteBuffer the ByteBuffer to write byteBuffer, Callback the callback to notify when the write operation is complete callback)Implements org. Writes the given |
| ASYNC_EOF | back to summary |
|---|---|
| private static final AsyncContent. | |
| chunks | back to summary |
|---|---|
| private final Queue<Content. | |
| demandCallback | back to summary |
|---|---|
| private Runnable demandCallback | |
| invoker | back to summary |
|---|---|
| private final SerializedInvoker invoker | |
| length | back to summary |
|---|---|
| private long length | |
| lock | back to summary |
|---|---|
| private final AutoLock. | |
| persistentFailure | back to summary |
|---|---|
| private Content. | |
| readClosed | back to summary |
|---|---|
| private boolean readClosed | |
| UNDETERMINED_LENGTH | back to summary |
|---|---|
| private static final int UNDETERMINED_LENGTH | |
| writeClosed | back to summary |
|---|---|
| private boolean writeClosed | |
| AsyncContent | back to summary |
|---|---|
| public AsyncContent() | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| count | back to summary |
|---|---|
| public int count() | |
| 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. | |
| fail | back to summary |
|---|---|
| public void fail(Throwable failure, boolean last) Overrides default org. Doc from org. Fails this content source with a A | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException | |
| getLength | back to summary |
|---|---|
| public long getLength() Overrides default org.
| |
| invokeDemandCallback | back to summary |
|---|---|
| private void invokeDemandCallback() | |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() | |
| offer | back to summary |
|---|---|
| private void offer(Content. The callback is stored to be failed in case fail() is called or succeeded if and only if the chunk is terminal, as non-terminal chunks have to bind the succeeding of the callback to their release. | |
| 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) | |
| write | back to summary |
|---|---|
| public void write(boolean last, ByteBuffer byteBuffer, Callback callback) Implements org. Doc from org. Writes the given 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 write completes:
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Callback | |
| private final Retainable. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRetain()
Overrides default org. Returns whether this resource is referenced counted by calls to |
| public void | failed(Throwable
the reason for the operation failure x)Overrides default org. Callback invoked when the operation fails. |
| public boolean | release()
Overrides default org. Releases this resource, potentially decrementing a reference count (if any). |
| public void | retain()
Overrides default org. Retains this resource, potentially incrementing a reference count if there are resources that will be released. |
| public void | succeeded()
Overrides default org. Callback invoked when the operation completes. |
| callback | back to summary |
|---|---|
| private final Callback callback | |
| referenceCounter | back to summary |
|---|---|
| private final Retainable. | |
| AsyncChunk | back to summary |
|---|---|
| public AsyncChunk(boolean last, ByteBuffer byteBuffer, Callback callback) | |
| canRetain | back to summary |
|---|---|
| public boolean canRetain() Overrides default org. Doc from org. Returns whether this resource is referenced counted by calls to Implementations may decide that special resources are not not referenced counted (for example,
| |
| failed | back to summary |
|---|---|
| public void failed(Throwable x) Overrides default org. Doc from org. Callback invoked when the operation fails. | |
| release | back to summary |
|---|---|
| public boolean release() Overrides default org. Doc from org. Releases this resource, potentially decrementing a reference count (if any).
| |
| retain | back to summary |
|---|---|
| public void retain() Overrides default org. Doc from org. Retains this resource, potentially incrementing a reference count if there are resources that will be released.
| |
| succeeded | back to summary |
|---|---|
| public void succeeded() Overrides default org. Doc from org. Callback invoked when the operation completes.
| |