This abstract Content. wraps another Content. and implementers need only
to implement the transform(Content. method, which is used to transform Content.
read from the wrapped source.
The demand(Runnable) conversation is passed directly to the wrapped Content.,
which means that transformations that may fully consume bytes read can result in a null return from
Content. even after a callback to the demand Runnable (as per spurious
invocation in Content..
| Modifier and Type | Field and Description |
|---|---|
| private volatile Runnable | |
| private final SerializedInvoker | |
| private volatile boolean | |
| private Content. | |
| private final Content. | |
| private Content. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| 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 |
| protected Content. | |
| private void | |
| private Content. | |
| public Content. | |
| private void | |
| protected abstract Content. | Returns: a transformed chunk ornulla chunk read from the wrapped inputChunkContent.Transforms the input chunk parameter into an output chunk. |
| demandCallback | back to summary |
|---|---|
| private volatile Runnable demandCallback | |
| invoker | back to summary |
|---|---|
| private final SerializedInvoker invoker | |
| needsRawRead | back to summary |
|---|---|
| private volatile boolean needsRawRead | |
| rawChunk | back to summary |
|---|---|
| private Content. | |
| rawSource | back to summary |
|---|---|
| private final Content. | |
| transformedChunk | back to summary |
|---|---|
| private Content. | |
| ContentSourceTransformer | back to summary |
|---|---|
| protected ContentSourceTransformer(Content. | |
| ContentSourceTransformer | back to summary |
|---|---|
| protected ContentSourceTransformer(Content. | |
| 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. | |
| getContentSource | back to summary |
|---|---|
| protected Content. | |
| invokeDemandCallback | back to summary |
|---|---|
| private void invokeDemandCallback() | |
| process | back to summary |
|---|---|
| private Content. | |
| 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) | |
| transform | back to summary |
|---|---|
| protected abstract Content. Transforms the input chunk parameter into an output chunk. When this method produces a non- The input chunk is released as soon as this method returns, so
implementations that must hold onto the input chunk must arrange to call
Implementations should return an Exceptions thrown by this method are equivalent to returning an error chunk. Implementations of this method may return:
| |