JVM | Platform | Status |
---|---|---|
OpenJDK (Temurin) Current | Linux | |
OpenJDK (Temurin) LTS | Linux | |
OpenJDK (Temurin) Current | Windows | |
OpenJDK (Temurin) LTS | Windows |
An opinionated, shaded, modularized distribution of the S3 client from the AWS SDK.
If you don't know why you need this specifically, you probably don't. Use the AWS SDK directly.
- An opinionated, shaded, modularized distribution of the S3 client from the AWS SDK.
- OSGi-ready.
- JPMS-ready.
- ISC license.
final var clients =
new HClients();
final var configuration =
HClientConfiguration.builder()
.setEndpoint(URI.create(endpoint))
.setCredentials(new HClientAccessKeys(access, secret))
.setBucketAccessStyle(HClientBucketAccessStyle.PATH_STYLE)
.build();
final var tempFile =
Paths.get("/tmp/file.txt");
try (var client = clients.createClient(configuration)) {
Files.writeString(tempFile, "Hello!\n");
{
final var r =
client.execute(
HPutObject.builder()
.setBucket("general")
.setContentType("text/plain")
.setKey("example.txt")
.setData(Files.readAllBytes(tempFile))
.build()
);
}
} catch (final HException e) {
LOG.error("{}: {}", e.errorCode(), e.getMessage());
for (final var entry : e.attributes().entrySet()) {
LOG.error(" {}: {}", entry.getKey(), entry.getValue());
}
LOG.error("Stacktrace: ", e);
}
A demo application is included.