-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a utility class to save large downloads to a file #929
Comments
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Would still be nice to have. |
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
@arsenalzp are you interested in implementing this one? |
Hello, |
@arsenalzp this is how I would like to use it: // Async mode.
httpClient.newRequest(host, port)
.send(new PathResponseListener(Path.of("/tmp/file.bin"));
// CompletableFuture mode.
var request = httpClient.newRequest(host, port);
CompletableFuture<Path> completable = PathResponseListener.write(request, Path.of("/tmp/file.bin"));
Start with simple test cases: a test that writes 0 bytes, one that writes 1 MiB and one that writes more than 1 GiB. Let me know if you need more guidance. |
…ile. * PathResponseListener now yields a PathResponse record with Path and Response. * Code cleanups. * Simplified test cases. * Added documentation. Signed-off-by: Simone Bordet <[email protected]>
HttpClient
could benefit of a utility class that saves the download bytes to a file, akin to:Perhaps call it
PathResponseListener
.Beware that
FileChannel.write(ByteBuffer)
returns the number of bytes written, that can be less than the bytes in the buffer, see also #630.The text was updated successfully, but these errors were encountered: