Improve javadoc to fix #11720 (#11731)

* Improve javadoc to fix #11720

---------

Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Greg Wilkins 2024-05-03 14:51:30 +02:00 committed by GitHub
parent 8e07ede5f9
commit 8e456c4ee5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -60,12 +60,13 @@ public class Content
* <p>Copies the given content source to the given content sink, notifying
* the given callback when the copy is complete (either succeeded or failed).</p>
* <p>In case of {@link Chunk#getFailure() failure chunks},
* the content source is {@link Source#fail(Throwable) failed} if the failure
* chunk is {@link Chunk#isLast() last}, else the failing is transient and is ignored.</p>
* the content source is {@link Source#fail(Throwable) failed}.</p>
*
* @param source the source to copy from
* @param sink the sink to copy to
* @param callback the callback to notify when the copy is complete
* @see #copy(Source, Sink, Chunk.Processor, Callback) to allow processing of individual {@link Chunk}s, including
* the ability to ignore transient failures.
*/
public static void copy(Source source, Sink sink, Callback callback)
{
@ -89,7 +90,7 @@ public class Content
*
* @param source the source to copy from
* @param sink the sink to copy to
* @param chunkProcessor a (possibly {@code null}) predicate to handle the current chunk and its callback
* @param chunkProcessor a (possibly {@code null}) processor to handle the current {@link Chunk} and its callback
* @param callback the callback to notify when the copy is complete
*/
public static void copy(Source source, Sink sink, Chunk.Processor chunkProcessor, Callback callback)
@ -902,9 +903,12 @@ public class Content
interface Processor
{
/**
* @param chunk The chunk to be considered for processing.
* @param chunk The chunk to be considered for processing, including persistent and transient failures.
* @param callback The callback that will be called once the accepted chunk is processed.
* @return True if the chunk will be process and the callback will be called (or may have already been called), false otherwise.
* {@link Callback#succeeded() Succeeding} this callback will allow the processing of subsequent chunks.
* {@link Callback#failed(Throwable) Failing} this callback will fail the processing of all chunks.
* @return {@code true} if the chunk will be processed asynchronously and the callback will be called (or may have already been called),
* {@code false} otherwise, in which case subsequent chunks may be processed and the passed callback ignored.
*/
boolean process(Chunk chunk, Callback callback);
}