Decorative site banner
Project icon

com.io7m.jdownload

  • About
  • Releases
  • Manual
  • Sources
  • License
  • Issues
Maven Central Version Maven Snapshot Code Coverage

jdownload


The jdownload package implements a trivial wrapper around the JDK HTTP client providing downloads, checksum verification, and transfer statistics.

Features


  • Trivial HTTP file downloader providing transfer statistics.
  • Automatic checksum verification for downloads.
  • Low dependency: Requires Java 21 and uses SLF4J for logging.
  • High coverage test suite.
  • OSGi-ready.
  • JPMS-ready.
  • ISC license.

Usage


HttpClient client; URI targetURI; Path outputFile; Path outputFileTemp;

Download a file from targetURI, writing the data temporarily to outputFileTemp and then atomically replacing outputFile with outputFileTemp if the download succeeds:

final var result = JDownloadRequests.builder(client, targetURI, outputFile, outputFileTemp) .build() .execute();

Perform the same download operation, but receive transfer statistics during the download:

Consumer<STTransferStatistics> receiver; final var result = JDownloadRequests.builder(client, targetURI, outputFile, outputFileTemp) .setTransferStatisticsReceiver(receiver) .build() .execute();

Perform the same download operation, but reject the download if the resulting file does not match the given checksum:

final byte[] checksum = HexFormat.of() .parseHex("2d8bd7d9bb5f85ba643f0110d50cb506a1fe439e769a22503193ea6046bb87f7"); final var result = JDownloadRequests.builder(client, targetURI, outputFile, outputFileTemp) .setChecksumStatically("SHA-256", checksum) .build() .execute();

Perform the same download operation, but reject the download if the resulting file does not match the checksum obtained from the given checksum URI:

Consumer<STTransferStatistics> receiver; Path checksumFile; Path checksumFileTemp; URI checksumURI; final var result = JDownloadRequests.builder(client, targetURI, outputFile, outputFileTemp) .setChecksumFromURL(checksumURI, "SHA-256", checksumFile, checksumFileTemp, receiver) .build() .execute();

Releases & Development Snapshots


Releases


You can subscribe to the atom feed to be notified of project releases.

The most recently released version of the package is 1.0.0.

1.0.0 Release (2024-05-11Z)

  • Initial public release.

The compiled artifacts for the release (and all previous releases) are available on Maven Central.

Maven Modules


<dependency> <group>com.io7m.jdownload</group> <artifactId>com.io7m.jdownload.core</artifactId> <version>1.0.0</version> </dependency><dependency> <group>com.io7m.jdownload</group> <artifactId>com.io7m.jdownload.tests</artifactId> <version>1.0.0</version> </dependency>

Development Snapshots


At the time of writing, the current unstable development version of the package is 1.0.1-SNAPSHOT.

Development snapshots may be available in the Central Portal Snapshots repository. Snapshots are published to this repository every time the project is built by the project's continuous integration system, but snapshots do expire after around ninety days and so may or may not be available depending on when a build of the package was last triggered.

Manual


This project does not have any user manuals or other documentation beyond what might be present on the page above.

Sources


This project uses Git to manage source code.

Repository: https://www.github.com/io7m-com/jdownload

$ git clone --recursive https://www.github.com/io7m-com/jdownload

Issues


This project uses GitHub Issues to track issues.

License


Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Last Updated 2025-08-09T12:40:04Z