Skip to content

krishnasrinivas/minio-java

 
 

Repository files navigation

Minio Java Library for Amazon S3 Compatible Cloud Storage Gitter

Install from maven Build Status

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

Install from gradle

compileDependencies {
    compile 'io.minio:minio:0.2.2'
}

Install from jars

You can download the latest jars directly from maven - Maven

Example

package hello.listbuckets;

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

How to run these examples?

Step 1: clone the project

$ git clone https://github.com/minio/minio-java

Edit examples with your favorite editor

Edit any examples you want to test and fill in access key placeholders

$ editor src/main/io/minio/examples/ListBuckets.java

Run the example

$ ./gradlew copyLibraries
$ java -cp 'lib/*' io.minio.examples.ListBuckets
bucket1
bucket2
....
...
bucketN

Contribute

Contributors Guide

About

Minio Java Library for Amazon S3 compatible cloud storage

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%