Interface DittoAttachmentFetchProgressHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Callback interface for monitoring attachment fetch progress.
This functional interface is used to receive progress updates while downloading an attachment from remote peers. It provides information about how many bytes have been downloaded and the total size of the attachment.
Example usage:
`DittoAttachmentFetchProgressHandler progressHandler = (downloadedBytes, totalBytes) ->{double progress = downloadedBytes.doubleValue()/ totalBytes.doubleValue() * 100.0;System.out.println("Download progress: " + progress + "%");return CompletableFuture.completedFuture(null);};`
-
Method Summary
Modifier and TypeMethodDescription@NonNull CompletionStage<Void> onFetchProgress(@NonNull DittoULong downloadedBytes, @NonNull DittoULong totalBytes) Called when attachment fetch progress is updated.
-
Method Details
-
onFetchProgress
@NonNull CompletionStage<Void> onFetchProgress(@NonNull DittoULong downloadedBytes, @NonNull DittoULong totalBytes) Called when attachment fetch progress is updated.
This method is invoked periodically as the attachment download progresses. It provides the current number of downloaded bytes and the total size of the attachment.
- Parameters:
downloadedBytes- the number of bytes downloaded so far.totalBytes- the total size of the attachment in bytes.- Returns:
- a
CompletionStagethat completes when the progress update has been processed.
-