Skip to content

Commit

Permalink
Progress javadoc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Jul 10, 2024
1 parent 6cbe7e4 commit c8b6f2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/jsoup/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,12 @@ default Connection auth(@Nullable RequestAuthenticator authenticator) {
Connection response(Response response);

/**
Set the response progress handler, which will be called as the response body is downloaded. As documents are parsed
as they are downloaded, this is also a good proxy for the parse progress.
<p>The Response is supplied as the progress context and may be read from to obtain headers etc.</p>
Set the response progress handler, which will be called periodically as the response body is downloaded. Since
documents are parsed as they are downloaded, this is also a good proxy for the parse progress.
<p>The Response object is supplied as the progress context, and may be read from to obtain headers etc.</p>
@param handler the progress handler
@return this Connection, for chaining
@since 1.18.1
*/
default Connection onResponseProgress(Progress<Response> handler) {
throw new UnsupportedOperationException();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jsoup/Progress.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jsoup;

@FunctionalInterface

public interface Progress<ProgressContext> {
/**
Called to report progress. Note that this will be executed by the same thread that is doing the work, so either
Expand All @@ -10,6 +11,7 @@ public interface Progress<ProgressContext> {
@param percent the percentage of completion, 0.0..100.0. If the expected total is unknown, % will remain at zero
until complete.
@param context the object that progress was made on.
@since 1.18.1
*/
void onProgress(int processed, int total, float percent, ProgressContext context);
}

0 comments on commit c8b6f2e

Please sign in to comment.