Skip to content

zhujo01/minio-java

 
 

Repository files navigation

Minio Java Library for Amazon S3 Compatible Cloud Storage Gitter

Download from maven

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

Download from gradle

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

Download from JAR

You can download the latest JAR directly from maven.

Example

import io.minio.MinioClient;
import io.minio.errors.ClientException;
import io.minio.messages.ListAllMyBucketsResult;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class HelloListBuckets {
    public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
        // Set s3 endpoint, region is calculated automatically
        Client s3client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");

        // list buckets
        Iterator<Bucket> bucketList = s3Client.listBuckets();
        while (bucketList.hasNext()) {
            Bucket bucket = bucketList.next();
            System.out.println(bucket.getName());
        }
    }
}

Additional Examples

Bucket Operations

Object Operations

Presigned Operations

How to run these examples?

Simply edit the example java program to include your access credentials and follow the steps below.

NOTE: minio-0.2.5-all.jar includes all the necessary dependencies to run these examples.

$ git clone https://github.com/minio/minio-java
$ cd minio-java
[edit examples/ListBuckets.java]
$ cd minio-java/examples; wget http://repo1.maven.org/maven2/io/minio/minio/0.2.5/minio-0.2.5-all.jar;
$ javac -cp 'minio-0.2.5-all.jar' ListBuckets.java
$ java -cp '.:minio-0.2.5-all.jar' ListBuckets
bucket1
bucket2
....
...
bucketN

Contribute

Contributors Guide

Build Status Build status

About

Minio Java Library for Amazon S3 compatible cloud storage

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages