Skip to content

Uninett/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>2.0.0</version>
</dependency>

Download from gradle

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

Download from JAR

You can download the latest JAR directly from maven.

Example

import io.minio.MinioClient;
import io.minio.messages.Bucket;
import io.minio.errors.MinioException;
import java.util.Iterator;
import java.util.List;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;
import org.xmlpull.v1.XmlPullParserException;

public class HelloListBuckets {
    public static void main(String[] args) throws NoSuchAlgorithmException, IOException, InvalidKeyException,     XmlPullParserException, MinioException {
        // Create a s3Client.
        MinioClient s3Client = new MinioClient("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");

        // list buckets
        List<Bucket> bucketList = s3Client.listBuckets();

        for (Bucket bucket : bucketList) {
            System.out.println(bucket.name());
        }
    }
}

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-2.0.0-all.jar includes all the necessary dependencies to run these examples.

$ sudo apt-get install openjdk-7-jdk
$ 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/2.0.0/minio-2.0.0-all.jar;
$ javac -cp 'minio-2.0.0-all.jar' ListBuckets.java
$ java -cp '.:minio-2.0.0-all.jar' ListBuckets
bucket1
bucket2
....
...
bucketN

Contribute

Contributors Guide

Build Status Build status

About

Minio Java Library for Amazon S3 compatible cloud storage

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%