Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #399

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 48 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,63 @@ You can download the latest [JAR](http://repo1.maven.org/maven2/io/minio/minio/2

## Example
```java

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");
import org.xmlpull.v1.XmlPullParserException;

// list buckets
List<Bucket> bucketList = s3Client.listBuckets();
import io.minio.MinioClient;
import io.minio.errors.MinioException;

for (Bucket bucket : bucketList) {
System.out.println(bucket.name());
}
public class FileUploader {
public static void main(String[] args) throws NoSuchAlgorithmException, IOException, InvalidKeyException, XmlPullParserException {
try {
// Create a minioClient with the Minio Server name, Port, Access key and Secret key.
MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

// Check if the bucket already exists.
boolean isExist = minioClient.bucketExists("asiatrip");
if(isExist) {
System.out.println("Bucket already exists.");
} else {
// Make a new bucket called asiatrip to hold a zip file of photos.
minioClient.makeBucket("asiatrip");
}

// Upload the zip file to the bucket with putObject
minioClient.putObject("asiatrip","asiaphotos.zip", "/tmp/asiaphotos.zip");
System.out.println("/tmp/asiaphotos.zip is successfully uploaded as asiaphotos.zip in asiatrip bucket.");
} catch(MinioException e) {
System.out.println("Error occured: " + e);
}
}
}

```
### API Reference
* [Complete API Reference] (https://docs.minio.io/docs/java-client-api-reference)

#### Bucket Operations
* [`makeBucket`](https://docs.minio.io/docs/java-client-api-reference#makeBucket)
* [`listBuckets`](https://docs.minio.io/docs/java-client-api-reference#listBuckets)
* [`bucketExists`](https://docs.minio.io/docs/java-client-api-reference#bucketExists)
* [`removeBucket`](https://docs.minio.io/docs/java-client-api-reference#removeBucket)
* [`listObjects`](https://docs.minio.io/docs/java-client-api-reference#listObjects)
* [`listIncompleteUploads`](https://docs.minio.io/docs/java-client-api-reference#listIncompleteUploads)

#### Object Operations
* [`getObject`](https://docs.minio.io/docs/java-client-api-reference#getObject)
* [`putObject`](https://docs.minio.io/docs/java-client-api-reference#putObject)
* [`statObject`](https://docs.minio.io/docs/java-client-api-reference#statObject)
* [`removeObject`](https://docs.minio.io/docs/java-client-api-reference#removeObject)
* [`removeIncompleteUpload`](https://docs.minio.io/docs/java-client-api-reference#removeIncompleteUpload)

#### Presigned Operations
* [`presignedGetObject`](https://docs.minio.io/docs/java-client-api-reference#presignedGetObject)
* [`presignedPutObject`](https://docs.minio.io/docs/java-client-api-reference#presignedPutObject)
* [`presignedPostPolicy`](https://docs.minio.io/docs/java-client-api-reference#presignedPostPolicy)


### Additional Examples

Expand Down