Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Minio Java Library for Amazon S3 compatible cloud storage

License

NotificationsYou must be signed in to change notification settings

sachin-walia/minio-java

 
 

Repository files navigation

The Minio Java Client SDK provides simple APIs to access any Amazon S3 compatible object storage server.

This quickstart guide will show you how to install the client SDK and execute an example java program. For a complete list of APIs and examples, please take a look at theJava Client API Reference documentation.

Minimum Requirements

Java 1.7 or above, with one of the following environments:

Download from maven

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

Download from gradle

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

Download from JAR

You can download the latestJAR directly from maven.

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.

ParamsDescription
EndpointURL to object storage service.
Access KeyAccess key is like user ID that uniquely identifies your account.
Secret KeySecret key is the password to your account.

For the following example, we will use a freely hosted Minio server running athttps://play.minio.io:9000. Feel free to use this service for test and development. Access credentials shown in this example are open to the public.

FileUploader.java

importjava.io.IOException;importjava.security.NoSuchAlgorithmException;importjava.security.InvalidKeyException;importorg.xmlpull.v1.XmlPullParserException;importio.minio.MinioClient;importio.minio.errors.MinioException;publicclassFileUploader {publicstaticvoidmain(String[]args)throwsNoSuchAlgorithmException,IOException,InvalidKeyException,XmlPullParserException {try {// Create a minioClient with the Minio Server name, Port, Access key and Secret key.MinioClientminioClient =newMinioClient("https://play.minio.io:9000","Q3AM3UQ867SPQQA43P2F","zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");// Check if the bucket already exists.booleanisExist =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 putObjectminioClient.putObject("asiatrip","asiaphotos.zip","/home/user/Photos/asiaphotos.zip");System.out.println("/home/user/Photos/asiaphotos.zip is successfully uploaded as asiaphotos.zip to `asiatrip` bucket.");    }catch(MinioExceptione) {System.out.println("Error occurred: " +e);    }  }}

Compile FileUploader

javac -cp"minio-3.0.3-all.jar"  FileUploader.java

Run FileUploader

java -cp"minio-3.0.3-all.jar:." FileUploader/home/user/Photos/asiaphotos.zip is successfully uploaded as asiaphotos.zip to`asiatrip` bucket.mc ls play/asiatrip/[2016-06-02 18:10:29 PDT]  82KiB asiaphotos.zip

API Reference

The full API Reference is available here.

API Reference: Bucket Operations

API Reference: Object Operations

API Reference: Presigned Operations

API Reference: Bucket Policy Operations

Full Examples

Full Examples: Bucket Operations

Full Examples: Object Operations

Full Examples: Presigned Operations

Full Examples: Bucket Policy Operations

Explore Further

Contribute

Contributors Guide

Build StatusBuild status

About

Minio Java Library for Amazon S3 compatible cloud storage

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java100.0%

[8]ページ先頭

©2009-2025 Movatter.jp