minio

Minio Java SDK for Amazon S3 Compatible Cloud Storage

License

License

GroupId

GroupId

com.sandinh
ArtifactId

ArtifactId

minio
Last Version

Last Version

3.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

minio
Minio Java SDK for Amazon S3 Compatible Cloud Storage
Project URL

Project URL

https://github.com/minio/minio-java
Source Code Management

Source Code Management

http://github.com/minio/minio-java

Download minio

How to add to project

<!-- https://jarcasting.com/artifacts/com.sandinh/minio/ -->
<dependency>
    <groupId>com.sandinh</groupId>
    <artifactId>minio</artifactId>
    <version>3.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.sandinh/minio/
implementation 'com.sandinh:minio:3.0.7'
// https://jarcasting.com/artifacts/com.sandinh/minio/
implementation ("com.sandinh:minio:3.0.7")
'com.sandinh:minio:jar:3.0.7'
<dependency org="com.sandinh" name="minio" rev="3.0.7">
  <artifact name="minio" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sandinh', module='minio', version='3.0.7')
)
libraryDependencies += "com.sandinh" % "minio" % "3.0.7"
[com.sandinh/minio "3.0.7"]

Dependencies

compile (10)

Group / Artifact Type Version
com.google.http-client : google-http-client-xml jar 1.20.0
com.google.guava : guava jar 18.0
com.squareup.okhttp3 : okhttp jar 3.7.0
com.squareup.okio : okio jar 1.12.0
joda-time : joda-time jar 2.7
com.fasterxml.jackson.core : jackson-annotations jar 2.9.0.pr3
com.fasterxml.jackson.core : jackson-core jar 2.9.0.pr3
com.fasterxml.jackson.core : jackson-databind jar 2.9.0.pr3
com.google.code.findbugs : annotations jar 3.0.1
com.google.code.findbugs : jsr305 jar 3.0.1

test (2)

Group / Artifact Type Version
com.squareup.okhttp3 : mockwebserver jar 3.7.0
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

MinIO Java SDK for Amazon S3 Compatible Cloud Storage Slack

MinIO Java SDK is Simple Storage Service (aka S3) client to perform bucket and object operations to any Amazon S3 compatible object storage service.

For a complete list of APIs and examples, please take a look at the Java Client API Reference documentation.

Minimum Requirements

Java 1.8 or above.

Maven usage

<dependency>
    <groupId>io.minio</groupId>
    <artifactId>minio</artifactId>
    <version>8.0.3</version>
</dependency>

Gradle usage

dependencies {
    compile 'io.minio:minio:8.0.3'
}

JAR download

The latest JAR can be downloaded from here

Quick Start Example - File Uploader

This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket.

You need three items in order to connect to an object storage server.

Parameters Description
Endpoint URL to S3 service.
Access Key Access key (aka user ID) of an account in the S3 service.
Secret Key Secret key (aka password) of an account in the S3 service.

This example uses MinIO server playground https://play.min.io. Feel free to use this service for test and development.

FileUploader.java

import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.UploadObjectArgs;
import io.minio.errors.MinioException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class FileUploader {
  public static void main(String[] args)
      throws IOException, NoSuchAlgorithmException, InvalidKeyException {
    try {
      // Create a minioClient with the MinIO server playground, its access key and secret key.
      MinioClient minioClient =
          MinioClient.builder()
              .endpoint("https://play.min.io")
              .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG")
              .build();

      // Make 'asiatrip' bucket if not exist.
      boolean found =
          minioClient.bucketExists(BucketExistsArgs.builder().bucket("asiatrip").build());
      if (!found) {
        // Make a new bucket called 'asiatrip'.
        minioClient.makeBucket(MakeBucketArgs.builder().bucket("asiatrip").build());
      } else {
        System.out.println("Bucket 'asiatrip' already exists.");
      }

      // Upload '/home/user/Photos/asiaphotos.zip' as object name 'asiaphotos-2015.zip' to bucket
      // 'asiatrip'.
      minioClient.uploadObject(
          UploadObjectArgs.builder()
              .bucket("asiatrip")
              .object("asiaphotos.zip")
              .filename("/home/user/Photos/asiaphotos.zip")
              .build());
      System.out.println(
          "'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
              + "object 'asiaphotos-2015.zip' to bucket 'asiatrip'.");
    } catch (MinioException e) {
      System.out.println("Error occurred: " + e);
    }
  }
}

Compile FileUploader

$ javac -cp minio-8.0.3-all.jar FileUploader.java

Run FileUploader

$ java -cp minio-8.0.3-all.jar:. FileUploader
'/home/user/Photos/asiaphotos.zip' is successfully uploaded as object 'asiaphotos-2015.zip' to bucket 'asiatrip'.

$ mc ls play/asiatrip/
[2016-06-02 18:10:29 PDT]  82KiB asiaphotos-2015.zip

More References

Explore Further

Contribute

Please refer Contributors Guide

com.sandinh

High Performance, Kubernetes Native Object Storage

Build high performance data infrastructure for machine learning, analytics and application data workloads with MinIO

Versions

Version
3.0.7