Install & connect
The client needs JDK 21 or newer and has no third-party runtime dependencies. The v0.0.8 release is available from LunarSky's public Maven repository.
For Gradle (Kotlin DSL):
repositories {
maven { url = uri("https://repo.lunarsky.cloud/") }
}
dependencies {
implementation("cloud.lunarsky:objectstore-client:0.0.8")
}For Maven, add the repository and dependency to pom.xml:
<repositories>
<repository>
<id>lunarsky</id>
<url>https://repo.lunarsky.cloud/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>cloud.lunarsky</groupId>
<artifactId>objectstore-client</artifactId>
<version>0.0.8</version>
</dependency>
</dependencies>No account or token is required to download it. To build the JAR yourself, run these commands from the v0.0.8 repository root:
bash client/scripts/test.sh
bash client/scripts/build.shThe build writes client/dist/objectstore-client.jar and generated Javadoc under client/dist/javadoc/. Add the JAR to your application's classpath. You can also download the client JAR from the v0.0.8 release.
import cloud.lunarsky.objectstore.client.ObjectStorageClient;
import cloud.lunarsky.objectstore.client.ObjectStorageClientBuilder;
import java.net.URI;
try (ObjectStorageClient storage = new ObjectStorageClientBuilder()
.endpoint(URI.create("https://storage.example.com"))
.region("us-east-1")
.credentials(accessKey, secretKey)
.build()) {
// Use storage here.
}endpoint must be an origin without a path, query, fragment, or user info. The default region is us-east-1 and the default per-request timeout is 30 seconds. Set .timeout(Duration.ofSeconds(...)) to change it. HTTPS is required unless .allowInsecureHttp() is explicitly called for a trusted local test endpoint. The client does not follow region redirects.
Keep access keys out of source code, logs, and screenshots. Each built client owns its HTTP resources; close it when finished.