public final class MinioClient extends Object
This class implements a simple cloud storage client. This client consists of a useful subset of S3 compatible functionality.
Optionally, users can also provide access/secret keys. If keys are provided, all requests by the client will be signed using AWS Signature Version 4.
For examples on using this library, please see .| Constructor and Description |
|---|
MinioClient(okhttp3.HttpUrl url)
Creates Minio client object with given HttpUrl object using anonymous access.
|
MinioClient(okhttp3.HttpUrl url,
String accessKey,
String secretKey)
Creates Minio client object with given URL object, access key and secret key.
|
MinioClient(String endpoint)
Creates Minio client object with given endpoint using anonymous access.
|
MinioClient(String endpoint,
int port,
String accessKey,
String secretKey)
Creates Minio client object with given endpoint, port, access key and secret key using secure (HTTPS) connection.
|
MinioClient(String endpoint,
int port,
String accessKey,
String secretKey,
boolean secure)
Creates Minio client object using given endpoint, port, access key, secret key and secure option.
|
MinioClient(String endpoint,
int port,
String accessKey,
String secretKey,
String region,
boolean secure)
Creates Minio client object using given endpoint, port, access key, secret key, region and secure option.
|
MinioClient(String endpoint,
int port,
String accessKey,
String secretKey,
String region,
boolean secure,
okhttp3.OkHttpClient httpClient)
Creates Minio client object using given endpoint, port, access key, secret key, region and secure option.
|
MinioClient(String endpoint,
String accessKey,
String secretKey)
Creates Minio client object with given endpoint, access key and secret key.
|
MinioClient(String endpoint,
String accessKey,
String secretKey,
boolean secure)
Creates Minio client object with given endpoint, access key and secret key using secure (HTTPS) connection.
|
MinioClient(String endpoint,
String accessKey,
String secretKey,
String region)
Creates Minio client object with given endpoint, access key, secret key and region name
|
MinioClient(URL url)
Creates Minio client object with given URL object using anonymous access.
|
MinioClient(URL url,
String accessKey,
String secretKey)
Creates Minio client object with given URL object, access key and secret key.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
bucketExists(String bucketName)
Checks if given bucket exist and is having read access.
|
void |
copyObject(String bucketName,
String objectName,
String destBucketName)
Copy a source object into a new destination object with same object name.
|
void |
copyObject(String bucketName,
String objectName,
String destBucketName,
CopyConditions copyConditions)
Copy a source object into a new object with the provided name in the provided bucket.
|
void |
copyObject(String bucketName,
String objectName,
String destBucketName,
String destObjectName)
Copy a source object into a new destination object.
|
void |
copyObject(String bucketName,
String objectName,
String destBucketName,
String destObjectName,
CopyConditions copyConditions)
Copy a source object into a new object with the provided name in the provided bucket.
|
void |
copyObject(String bucketName,
String objectName,
String destBucketName,
String destObjectName,
CopyConditions copyConditions,
Map<String,String> metadata)
Copy a source object into a new object with the provided name in the provided bucket.
|
NotificationConfiguration |
getBucketNotification(String bucketName)
Get bucket notification configuration
|
PolicyType |
getBucketPolicy(String bucketName,
String objectPrefix)
Get bucket policy at given objectPrefix
|
InputStream |
getObject(String bucketName,
String objectName)
Gets entire object's data as
InputStream in given bucket. |
InputStream |
getObject(String bucketName,
String objectName,
KeyPair key)
Returns
InputStream containing decrypted data of given object. |
InputStream |
getObject(String bucketName,
String objectName,
long offset)
Gets object's data starting from given offset as
InputStream in the given bucket. |
InputStream |
getObject(String bucketName,
String objectName,
long offset,
Long length)
Gets object's data of given offset and length as
InputStream in the given bucket. |
InputStream |
getObject(String bucketName,
String objectName,
SecretKey key)
Returns
InputStream containing decrypted data of given object. |
void |
getObject(String bucketName,
String objectName,
String fileName)
Gets object's data in the given bucket and stores it to given file name.
|
String |
getObjectUrl(String bucketName,
String objectName)
Gets object's URL in given bucket.
|
void |
ignoreCertCheck()
Ignores check on server certificate for HTTPS connection.
|
List<Bucket> |
listBuckets()
Returns all bucket information owned by the current user.
|
Iterable<Result<Upload>> |
listIncompleteUploads(String bucketName)
Lists incomplete uploads of objects in given bucket.
|
Iterable<Result<Upload>> |
listIncompleteUploads(String bucketName,
String prefix)
Lists incomplete uploads of objects in given bucket and prefix.
|
Iterable<Result<Upload>> |
listIncompleteUploads(String bucketName,
String prefix,
boolean recursive)
Lists incomplete uploads of objects in given bucket, prefix and recursive flag.
|
Iterable<Result<Item>> |
listObjects(String bucketName)
Lists object information in given bucket.
|
Iterable<Result<Item>> |
listObjects(String bucketName,
String prefix)
Lists object information in given bucket and prefix.
|
Iterable<Result<Item>> |
listObjects(String bucketName,
String prefix,
boolean recursive)
Lists object information as
Iterable<Result><Item>> in given bucket, prefix and recursive flag. |
Iterable<Result<Item>> |
listObjects(String bucketName,
String prefix,
boolean recursive,
boolean useVersion1)
Lists object information as
Iterable<Result><Item>> in given bucket, prefix, recursive flag and S3 API
version to use. |
void |
makeBucket(String bucketName)
Creates a bucket with default region.
|
void |
makeBucket(String bucketName,
String region)
Creates a bucket with given region.
|
String |
presignedGetObject(String bucketName,
String objectName)
Returns an presigned URL to download the object in the bucket with default expiry time.
|
String |
presignedGetObject(String bucketName,
String objectName,
Integer expires)
Returns an presigned URL to download the object in the bucket with given expiry time.
|
String |
presignedGetObject(String bucketName,
String objectName,
Integer expires,
Map<String,String> reqParams)
Returns an presigned URL to download the object in the bucket with given expiry time with custom request params.
|
Map<String,String> |
presignedPostPolicy(PostPolicy policy)
Returns string map for given
PostPolicy to upload object with various post policy conditions. |
String |
presignedPutObject(String bucketName,
String objectName)
Returns a presigned URL to upload an object in the bucket with default expiry time.
|
String |
presignedPutObject(String bucketName,
String objectName,
Integer expires)
Returns a presigned URL to upload an object in the bucket with given expiry time.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
Map<String,String> headerMap)
Uploads data from given stream as object to given bucket with specified meta data.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
String contentType)
Uploads data from given stream as object to given bucket.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
String contentType,
KeyPair keypair)
Uploads encrypted data from given stream as object to given bucket where data is encrypted on the fly using passed
keypair.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
String contentType,
SecretKey key)
Uploads encrypted data from given stream as object to given bucket where data is encrypted on the fly using passed
secret key.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
String contentType)
Uploads data from given stream as object to given bucket where the stream size is unknown.
|
void |
putObject(String bucketName,
String objectName,
String fileName)
Uploads given file as object in given bucket.
|
void |
putObject(String bucketName,
String objectName,
String fileName,
String contentType)
Uploads given file as object in given bucket.
|
void |
removeAllBucketNotification(String bucketName)
Remove all bucket notification.
|
void |
removeBucket(String bucketName)
Removes a bucket.
|
void |
removeIncompleteUpload(String bucketName,
String objectName)
Removes incomplete multipart upload of given object.
|
Iterable<Result<DeleteError>> |
removeObject(String bucketName,
Iterable<String> objectNames)
Removes multiple objects from a bucket.
|
void |
removeObject(String bucketName,
String objectName)
Removes an object from a bucket.
|
void |
setAppInfo(String name,
String version)
Sets application's name/version to user agent.
|
void |
setBucketNotification(String bucketName,
NotificationConfiguration notificationConfiguration)
Set bucket notification configuration
|
void |
setBucketPolicy(String bucketName,
String objectPrefix,
PolicyType policyType)
Set policy on bucket and object prefix.
|
void |
setTimeout(long connectTimeout,
long writeTimeout,
long readTimeout)
Sets HTTP connect, write and read timeouts.
|
ObjectStat |
statObject(String bucketName,
String objectName)
Returns meta data information of given object in given bucket.
|
void |
traceOff()
Disables HTTP call tracing previously enabled.
|
void |
traceOn(OutputStream traceStream)
Enables HTTP call tracing and written to traceStream.
|
public MinioClient(String endpoint) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient = new MinioClient("https://play.minio.io:9000"); endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1InvalidEndpointExceptionInvalidPortExceptionMinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(URL url) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient = new MinioClient(new URL("https://play.minio.io:9000")); url - Endpoint URL object.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(okhttp3.HttpUrl url)
throws InvalidEndpointException,
InvalidPortException
MinioClient minioClient = new MinioClient(new HttpUrl.parse("https://play.minio.io:9000")); url - Endpoint HttpUrl object.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, String accessKey, String secretKey) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient = new MinioClient("https://play.minio.io:9000",
"YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY"); endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, String accessKey, String secretKey, String region) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient = new MinioClient("https://play.minio.io:9000",
"YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", "us-east-1"); endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.region - Region name to access service in endpoint.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(URL url, String accessKey, String secretKey) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient = new MinioClient(new URL("https://play.minio.io:9000"),
"YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY"); url - Endpoint URL object.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(okhttp3.HttpUrl url,
String accessKey,
String secretKey)
throws InvalidEndpointException,
InvalidPortException
MinioClient minioClient = new MinioClient(HttpUrl.parse("https://play.minio.io:9000"),
"YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY"); url - Endpoint HttpUrl object.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, int port, String accessKey, String secretKey) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient =
new MinioClient("play.minio.io", 9000, "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1port - Valid port. It should be in between 1 and 65535. Unused if endpoint is an URL.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient =
new MinioClient("play.minio.io:9000", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true);
endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.secure - If true, access endpoint using HTTPS else access it using HTTP.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient =
new MinioClient("play.minio.io", 9000, "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", false);
endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1port - Valid port. It should be in between 1 and 65535. Unused if endpoint is an URL.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.secure - If true, access endpoint using HTTPS else access it using HTTP.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient =
new MinioClient("play.minio.io", 9000, "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", "us-east-1", false);
endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1port - Valid port. It should be in between 1 and 65535. Unused if endpoint is an URL.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.region - Region name to access service in endpoint.secure - If true, access endpoint using HTTPS else access it using HTTP.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure,
OkHttpClient httpClient)public MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure, okhttp3.OkHttpClient httpClient) throws InvalidEndpointException, InvalidPortException
MinioClient minioClient =
new MinioClient("play.minio.io", 9000, "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", "us-east-1", false,
customHttpClient);
endpoint - Request endpoint. Endpoint is an URL, domain name, IPv4 or IPv6 address.
Valid endpoints:
* https://s3.amazonaws.com
* https://s3.amazonaws.com/
* https://play.minio.io:9000
* http://play.minio.io:9010/
* localhost
* localhost.localdomain
* play.minio.io
* 127.0.0.1
* 192.168.1.60
* ::1port - Valid port. It should be in between 1 and 65535. Unused if endpoint is an URL.accessKey - Access key to access service in endpoint.secretKey - Secret key to access service in endpoint.region - Region name to access service in endpoint.secure - If true, access endpoint using HTTPS else access it using HTTP.httpClient - Customized HTTP client object.InvalidEndpointExceptionInvalidPortExceptionMinioClient(String endpoint),
MinioClient(URL url),
MinioClient(String endpoint, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, String region),
MinioClient(URL url, String accessKey, String secretKey),
MinioClient(String endpoint, int port, String accessKey, String secretKey),
MinioClient(String endpoint, String accessKey, String secretKey, boolean secure),
MinioClient(String endpoint, int port, String accessKey, String secretKey, String region, boolean secure)public void setTimeout(long connectTimeout,
long writeTimeout,
long readTimeout)
minioClient.setTimeout(TimeUnit.SECONDS.toMillis(10), TimeUnit.SECONDS.toMillis(10),
TimeUnit.SECONDS.toMillis(30)); connectTimeout - HTTP connect timeout in milliseconds.writeTimeout - HTTP write timeout in milliseconds.readTimeout - HTTP read timeout in milliseconds.public void ignoreCertCheck()
throws NoSuchAlgorithmException,
KeyManagementException
minioClient.ignoreCertCheck(); public void setAppInfo(String name, String version)
name - Your application name.version - Your application version.public ObjectStat statObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
ObjectStat objectStat = minioClient.statObject("my-bucketname", "my-objectname");
System.out.println(objectStat); bucketName - Bucket name.objectName - Object name in the bucket.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionObjectStatpublic String getObjectUrl(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
Example:
String url = minioClient.getObjectUrl("my-bucketname", "my-objectname");
System.out.println(url); bucketName - Bucket name.objectName - Object name in the bucket.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic InputStream getObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
InputStream in given bucket. The InputStream must be closed
after use else the connection will remain open.
Example:
InputStream stream = minioClient.getObject("my-bucketname", "my-objectname");
byte[] buf = new byte[16384];
int bytesRead;
while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) {
System.out.println(new String(buf, 0, bytesRead));
}
stream.close(); bucketName - Bucket name.objectName - Object name in the bucket.InputStream containing the object data.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic InputStream getObject(String bucketName, String objectName, long offset) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
InputStream in the given bucket. The InputStream must be
closed after use else the connection will remain open.
Example: InputStream stream = minioClient.getObject("my-bucketname", "my-objectname", 1024L);
byte[] buf = new byte[16384];
int bytesRead;
while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) {
System.out.println(new String(buf, 0, bytesRead));
}
stream.close(); bucketName - Bucket name.objectName - Object name in the bucket.offset - Offset to read at.InputStream containing the object's data.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic InputStream getObject(String bucketName, String objectName, long offset, Long length) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
InputStream in the given bucket. The InputStream must be
closed after use else the connection will remain open.
Example: InputStream stream = minioClient.getObject("my-bucketname", "my-objectname", 1024L, 4096L);
byte[] buf = new byte[16384];
int bytesRead;
while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) {
System.out.println(new String(buf, 0, bytesRead));
}
stream.close(); bucketName - Bucket name.objectName - Object name in the bucket.offset - Offset to read at.length - Length to read.InputStream containing the object's data.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic void getObject(String bucketName, String objectName, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
minioClient.getObject("my-bucketname", "my-objectname", "photo.jpg"); bucketName - Bucket name.objectName - Object name in the bucket.fileName - file name.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic InputStream getObject(String bucketName, String objectName, SecretKey key) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidEncryptionMetadataException
InputStream containing decrypted data of given object. Secret key passed to this method should be
the same as the one used for putObject() operation.
The returned InputStream must be closed after use else the connection will remain open.
Example:
{
// Get object with symmetric master key used in putObject
InputStream stream = minioClient.getObject("my-bucketname", "my-objectname", key);
byte[] buf = new byte[16384];
int bytesRead;
while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) {
System.out.println(new String(buf, 0, bytesRead));
}
stream.close();
}
bucketName - Bucket name.objectName - Object name in the bucket.key - Symmetric key used for corresponding putOject operation.InputStream containing the object data.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidEncryptionMetadataException - upon encryption key/iv errorBadPaddingException - upon wrong paddingIllegalBlockSizeException - upon incorrect block sizeNoSuchPaddingException - upon incorrect paddingInvalidAlgorithmParameterException - upon incorrect algorithmNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptiongetObject(String bucketName, String objectName),
getObject(String bucketName, String objectName, long offset),
getObject(String bucketName, String objectName, long offset, Long length),
getObject(String bucketName, String objectName, String filename),
getObject(String bucketName, String objectName, KeyPair key)public InputStream getObject(String bucketName, String objectName, KeyPair key) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidEncryptionMetadataException
InputStream containing decrypted data of given object. Keypair passed to this method should be the
same as the one used for putObject() operation.
The returned InputStream must be closed after use else the connection will remain open.
Example:
{
// Get object with symmetric master key used in putObject
InputStream stream = minioClient.getObject("my-bucketname", "my-objectname", keypair);
byte[] buf = new byte[16384];
int bytesRead;
while ((bytesRead = stream.read(buf, 0, buf.length)) >= 0) {
System.out.println(new String(buf, 0, bytesRead));
}
stream.close();
}
bucketName - Bucket name.objectName - Object name in the bucket.key - Asymmetric keypair used for corresponding putOject operation.InputStream containing the object data.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidEncryptionMetadataException - upon encryption key/iv errorBadPaddingException - upon wrong paddingIllegalBlockSizeException - upon incorrect block sizeNoSuchPaddingException - upon incorrect paddingInvalidAlgorithmParameterException - upon incorrect algorithmNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptiongetObject(String bucketName, String objectName),
getObject(String bucketName, String objectName, long offset),
getObject(String bucketName, String objectName, long offset, Long length),
getObject(String bucketName, String objectName, String filename),
getObject(String bucketName, String objectName, SecretKey key)public void copyObject(String bucketName, String objectName, String destBucketName) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname");
bucketName - Bucket name where the object to be copied exists.objectName - Object name source to be copied.destBucketName - Bucket name where the object will be copied to.InvalidBucketNameException - upon an invalid bucket nameNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidKeyException - upon an invalid access key or secret keyInsufficientDataExceptionNoResponseExceptionErrorResponseExceptionInternalExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionInvalidArgumentExceptionpublic void copyObject(String bucketName, String objectName, String destBucketName, String destObjectName) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname", "my-destobjname");
bucketName - Bucket name where the object to be copied exists.objectName - Object name source to be copied.destBucketName - Bucket name where the object will be copied to.destObjectName - Object name to be created, if not provided uses source object name
as destination object name.InvalidBucketNameException - upon an invalid bucket nameNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidKeyException - upon an invalid access key or secret keyInsufficientDataExceptionNoResponseExceptionErrorResponseExceptionInternalExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionInvalidArgumentExceptionpublic void copyObject(String bucketName, String objectName, String destBucketName, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname",
copyConditions);
bucketName - Bucket name where the object to be copied exists.objectName - Object name source to be copied.destBucketName - Bucket name where the object will be copied to.copyConditions - CopyConditions object with collection of supported CopyObject conditions.InvalidBucketNameException - upon an invalid bucket nameNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidKeyException - upon an invalid access key or secret keyInsufficientDataExceptionNoResponseExceptionErrorResponseExceptionInternalExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionInvalidArgumentExceptionpublic void copyObject(String bucketName, String objectName, String destBucketName, String destObjectName, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname",
"my-destobjname", copyConditions);
bucketName - Bucket name where the object to be copied exists.objectName - Object name source to be copied.destBucketName - Bucket name where the object will be copied to.destObjectName - Object name to be created, if not provided uses source object name
as destination object name.copyConditions - CopyConditions object with collection of supported CopyObject conditions.InvalidBucketNameException - upon an invalid bucket name, invalid object name.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidKeyException - upon an invalid access key or secret keyInsufficientDataExceptionNoResponseExceptionErrorResponseExceptionInternalExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionInvalidArgumentExceptionpublic void copyObject(String bucketName, String objectName, String destBucketName, String destObjectName, CopyConditions copyConditions, Map<String,String> metadata) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname",
"my-destobjname", copyConditions, metadata);
bucketName - Bucket name where the object to be copied exists.objectName - Object name source to be copied.destBucketName - Bucket name where the object will be copied to.destObjectName - Object name to be created, if not provided uses source object name
as destination object name.copyConditions - CopyConditions object with collection of supported CopyObject conditions.metadata - Additional metadata to set on the destination object when
setMetadataDirective is set to 'REPLACE'.InvalidBucketNameException - upon an invalid bucket name, invalid object name.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidKeyException - upon an invalid access key or secret keyInsufficientDataExceptionNoResponseExceptionErrorResponseExceptionInternalExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionInvalidArgumentExceptionpublic String presignedGetObject(String bucketName, String objectName, Integer expires, Map<String,String> reqParams) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException
String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24, reqParams);
System.out.println(url); bucketName - Bucket name.objectName - Object name in the bucket.expires - Expiration time in seconds of presigned URL.reqParams - Override values for set of response headers. Currently supported request parameters are
[response-expires, response-content-type, response-cache-control, response-content-disposition]InvalidBucketNameException - upon an invalid bucket nameInvalidKeyException - upon an invalid access key or secret keyIOException - upon signature calculation failureNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidExpiresRangeException - upon input expires is out of rangeInsufficientDataExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic String presignedGetObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException
String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24);
System.out.println(url); bucketName - Bucket name.objectName - Object name in the bucket.expires - Expiration time in seconds of presigned URL.InvalidBucketNameException - upon an invalid bucket nameInvalidKeyException - upon an invalid access key or secret keyIOException - upon signature calculation failureNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidExpiresRangeException - upon input expires is out of rangeInsufficientDataExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic String presignedGetObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException
String url = minioClient.presignedGetObject("my-bucketname", "my-objectname");
System.out.println(url); bucketName - Bucket name.objectName - Object name in the bucket.IOException - upon connection errorNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidExpiresRangeException - upon input expires is out of rangeInvalidBucketNameExceptionInsufficientDataExceptionInvalidKeyExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic String presignedPutObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException
String url = minioClient.presignedPutObject("my-bucketname", "my-objectname", 60 * 60 * 24);
System.out.println(url); bucketName - Bucket nameobjectName - Object name in the bucketexpires - Expiration time in seconds to presigned URL.InvalidBucketNameException - upon an invalid bucket nameInvalidKeyException - upon an invalid access key or secret keyIOException - upon signature calculation failureNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidExpiresRangeException - upon input expires is out of rangeInsufficientDataExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic String presignedPutObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException
String url = minioClient.presignedPutObject("my-bucketname", "my-objectname");
System.out.println(url); bucketName - Bucket name.objectName - Object name in the bucket.IOException - upon connection errorNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInvalidExpiresRangeException - upon input expires is out of rangeInvalidBucketNameExceptionInsufficientDataExceptionInvalidKeyExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic Map<String,String> presignedPostPolicy(PostPolicy policy) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
PostPolicy to upload object with various post policy conditions.
Example: // Create new PostPolicy object for 'my-bucketname', 'my-objectname' and 7 days expire time from now.
PostPolicy policy = new PostPolicy("my-bucketname", "my-objectname", DateTime.now().plusDays(7));
// 'my-objectname' should be 'image/png' content type
policy.setContentType("image/png");
Map<String,String> formData = minioClient.presignedPostPolicy(policy);
// Print a curl command that can be executable with the file /tmp/userpic.png and the file will be uploaded.
System.out.print("curl -X POST ");
for (Map.Entry<String,String> entry : formData.entrySet()) {
System.out.print(" -F " + entry.getKey() + "=" + entry.getValue());
}
System.out.println(" -F file=@/tmp/userpic.png https://play.minio.io:9000/my-bucketname"); policy - Post policy of an object.InvalidBucketNameExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionIOExceptionInvalidKeyExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionInvalidArgumentExceptionPostPolicypublic void removeObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
minioClient.removeObject("my-bucketname", "my-objectname"); bucketName - Bucket name.objectName - Object name in the bucket.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic Iterable<Result<DeleteError>> removeObject(String bucketName, Iterable<String> objectNames)
// Create object list for removal.
List<String> objectNames = new LinkedList<String>();
objectNames.add("my-objectname1");
objectNames.add("my-objectname2");
objectNames.add("my-objectname3");
for (Result<DeleteError> errorResult: minioClient.removeObject("my-bucketname", objectNames)) {
DeleteError error = errorResult.get();
System.out.println("Failed to remove '" + error.objectName() + "'. Error:" + error.message());
} bucketName - Bucket name.objectNames - List of Object names in the bucket.public Iterable<Result<Item>> listObjects(String bucketName) throws org.xmlpull.v1.XmlPullParserException
bucketName - Bucket name.org.xmlpull.v1.XmlPullParserExceptionpublic Iterable<Result<Item>> listObjects(String bucketName, String prefix) throws org.xmlpull.v1.XmlPullParserException
bucketName - Bucket name.prefix - Prefix string. List objects whose name starts with `prefix`.org.xmlpull.v1.XmlPullParserExceptionpublic Iterable<Result<Item>> listObjects(String bucketName, String prefix, boolean recursive)
Iterable<Result><Item>> in given bucket, prefix and recursive flag.
Example: Iterable<Result<Item>> myObjects = minioClient.listObjects("my-bucketname");
for (Result<Item> result : myObjects) {
Item item = result.get();
System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName());
} bucketName - Bucket name.prefix - Prefix string. List objects whose name starts with `prefix`.recursive - when false, emulates a directory structure where each listing returned is either a full object
or part of the object's key up to the first '/'. All objects wit the same prefix up to the first
'/' will be merged into one entry.listObjects(String bucketName),
listObjects(String bucketName, String prefix),
listObjects(String bucketName, String prefix, boolean recursive, boolean useVersion1)public Iterable<Result<Item>> listObjects(String bucketName, String prefix, boolean recursive, boolean useVersion1)
Iterable<Result><Item>> in given bucket, prefix, recursive flag and S3 API
version to use.
Example: Iterable<Result<Item>> myObjects = minioClient.listObjects("my-bucketname", "my-object-prefix", true,
false);
for (Result<Item> result : myObjects) {
Item item = result.get();
System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName());
} bucketName - Bucket name.prefix - Prefix string. List objects whose name starts with `prefix`.recursive - when false, emulates a directory structure where each listing returned is either a full object
or part of the object's key up to the first '/'. All objects wit the same prefix up to the first
'/' will be merged into one entry.useVersion1 - If set, Amazon AWS S3 List Object V1 is used, else List Object V2 is used as default.listObjects(String bucketName),
listObjects(String bucketName, String prefix),
listObjects(String bucketName, String prefix, boolean recursive)public List<Bucket> listBuckets() throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
List<Bucket> bucketList = minioClient.listBuckets();
for (Bucket bucket : bucketList) {
System.out.println(bucket.creationDate() + ", " + bucket.name());
} NoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidBucketNameExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic boolean bucketExists(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
boolean found = minioClient.bucketExists("my-bucketname");
if (found) {
System.out.println("my-bucketname exists");
} else {
System.out.println("my-bucketname does not exist");
} bucketName - Bucket name.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void makeBucket(String bucketName) throws InvalidBucketNameException, RegionConflictException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorRegionConflictExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void makeBucket(String bucketName, String region) throws InvalidBucketNameException, RegionConflictException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
minioClient.makeBucket("my-bucketname");
System.out.println("my-bucketname is created successfully"); bucketName - Bucket name.region - region in which the bucket will be created.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorRegionConflictExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void removeBucket(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
NOTE: - All objects (including all object versions and delete markers) in the bucket must be deleted prior, this API will not recursively delete objects
Example: minioClient.removeBucket("my-bucketname");
System.out.println("my-bucketname is removed successfully"); bucketName - Bucket name.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void putObject(String bucketName, String objectName, String fileName, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException
If the object is larger than 5MB, the client will automatically use a multipart session.
If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. The client will examine all parts of any current upload session and attempt to reuse the session automatically. If a mismatch is discovered, the upload will fail before uploading any more data. Otherwise, it will resume uploading where the session left off.
If the multipart session fails, the user is responsible for resuming or removing the session.
bucketName - Bucket name.objectName - Object name to create in the bucket.fileName - File name to upload.contentType - File content type of the object, user supplied.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic void putObject(String bucketName, String objectName, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException
If the object is larger than 5MB, the client will automatically use a multipart session.
If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. The client will examine all parts of any current upload session and attempt to reuse the session automatically. If a mismatch is discovered, the upload will fail before uploading any more data. Otherwise, it will resume uploading where the session left off.
If the multipart session fails, the user is responsible for resuming or removing the session.
bucketName - Bucket name.objectName - Object name to create in the bucket.fileName - File name to upload.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionpublic void putObject(String bucketName, String objectName, InputStream stream, long size, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException
If the object is larger than 5MB, the client will automatically use a multipart session.
If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. The client will examine all parts of any current upload session and attempt to reuse the session automatically. If a mismatch is discovered, the upload will fail before uploading any more data. Otherwise, it will resume uploading where the session left off.
If the multipart session fails, the user is responsible for resuming or removing the session.
Example: StringBuilder builder = new StringBuilder();
for (int i = 0; i < 1000; i++) {
builder.append("Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. ");
builder.append("(29 letters)\n");
builder.append("Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. ");
builder.append("(31 letters)\n");
builder.append("Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on ");
builder.append("NASAs Space Shuttle. (32 letters)\n");
builder.append("The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. ");
builder.append("(39 letters)\n");
builder.append("How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity ");
builder.append("awards at 49 letters long, but old-time Mac users may recognize it.\n");
builder.append("Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac ");
builder.append("computers after System 7.\n");
builder.append("A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my ");
builder.append("brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n");
builder.append("---\n");
}
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));
// create object
minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(), "application/octet-stream");
bais.close();
System.out.println("my-objectname is uploaded successfully"); bucketName - Bucket name.objectName - Object name to create in the bucket.stream - stream to upload.size - Size of all the data that will be uploaded.contentType - Content type of the stream.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionputObject(String bucketName, String objectName, String fileName)public void putObject(String bucketName, String objectName, InputStream stream, long size, Map<String,String> headerMap) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException
If the object is larger than 5MB, the client will automatically use a multipart session.
If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. The client will examine all parts of any current upload session and attempt to reuse the session automatically. If a mismatch is discovered, the upload will fail before uploading any more data. Otherwise, it will resume uploading where the session left off.
If the multipart session fails, the user is responsible for resuming or removing the session.
Example: StringBuilder builder = new StringBuilder();
for (int i = 0; i < 1000; i++) {
builder.append("Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. ");
builder.append("(29 letters)\n");
builder.append("Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. ");
builder.append("(31 letters)\n");
builder.append("Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on ");
builder.append("NASAs Space Shuttle. (32 letters)\n");
builder.append("The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. ");
builder.append("(39 letters)\n");
builder.append("How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity ");
builder.append("awards at 49 letters long, but old-time Mac users may recognize it.\n");
builder.append("Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac ");
builder.append("computers after System 7.\n");
builder.append("A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my ");
builder.append("brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n");
builder.append("---\n");
}
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));
// create object
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Content-Type", "application/octet-stream");
minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(), headerMap);
bais.close();
System.out.println("my-objectname is uploaded successfully"); bucketName - Bucket name.objectName - Object name to create in the bucket.stream - stream to upload.size - Size of all the data that will be uploaded.headerMap - Custom/additional meta data of the object.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionputObject(String bucketName, String objectName, String fileName)public void putObject(String bucketName, String objectName, InputStream stream, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException
If the stream has more than 525MiB data, the client uses a multipart session automatically.
If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. The client will examine all parts of any current upload session and attempt to reuse the session automatically. If a mismatch is discovered, the upload will fail before uploading any more data. Otherwise, it will resume uploading where the session left off.
If the multipart session fails, the user is responsible for resuming or removing the session.
Example: StringBuilder builder = new StringBuilder();
for (int i = 0; i < 1000; i++) {
builder.append("Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. ");
builder.append("(29 letters)\n");
builder.append("Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. ");
builder.append("(31 letters)\n");
builder.append("Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on ");
builder.append("NASAs Space Shuttle. (32 letters)\n");
builder.append("The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. ");
builder.append("(39 letters)\n");
builder.append("How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity ");
builder.append("awards at 49 letters long, but old-time Mac users may recognize it.\n");
builder.append("Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac ");
builder.append("computers after System 7.\n");
builder.append("A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my ");
builder.append("brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n");
builder.append("---\n");
}
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));
// create object
minioClient.putObject("my-bucketname", "my-objectname", bais, "application/octet-stream");
bais.close();
System.out.println("my-objectname is uploaded successfully"); bucketName - Bucket name.objectName - Object name to create in the bucket.stream - stream to upload.contentType - Content type of the stream.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionputObject(String bucketName, String objectName, String fileName)public void putObject(String bucketName, String objectName, InputStream stream, long size, String contentType, SecretKey key) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException
If the object is larger than 5MB, the client will automatically use a multipart session.
Example:
{ @code StringBuilder builder = new StringBuilder(); for (int i = 0; i < 1000; i++) {
builder.append("Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. ");
builder.append("(29 letters)\n");
builder.append("Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. ");
builder.append("(31 letters)\n");
builder.append("Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on ");
builder.append("NASAs Space Shuttle. (32 letters)\n");
builder.append("The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. ");
builder.append("(39 letters)\n");
builder.append("How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity ");
builder.append("awards at 49 letters long, but old-time Mac users may recognize it.\n");
builder.append("Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac ");
builder.append("computers after System 7.\n");
builder.append("A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my ");
builder.append("brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n"); builder.append("---\n"); }
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));
// Generate symmetric 256 bit AES key. KeyGenerator symKeyGenerator = KeyGenerator.getInstance("AES");
symKeyGenerator.init(256); SecretKey symKey = symKeyGenerator.generateKey();
// create object minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(),
"application/octet-stream", symKey); bais.close(); System.out.println("my-bucketname is uploaded successfully"); }
bucketName - Bucket name.objectName - Object name to create in the bucket.stream - stream to upload.size - Size of all the data that will be uploaded.contentType - Content type of the stream.key - Master key for encryption.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidAlgorithmParameterException - upon wrong encryption algorithm usedBadPaddingException - upon incorrect padding in a blockIllegalBlockSizeException - upon incorrect blockNoSuchPaddingException - upon wrong padding type specifiedNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionputObject(String bucketName, String objectName, String fileName, String contentType),
putObject(String bucketName, String objectName, String fileName),
putObject(String bucketName, String objectName, InputStream stream, long size, String contentType),
putObject(String bucketName, String objectName, InputStream stream, long size, String contentType, KeyPair
keypair)public void putObject(String bucketName, String objectName, InputStream stream, long size, String contentType, KeyPair keypair) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException
If the object is larger than 5MB, the client will automatically use a multipart session.
Example:
{
@code
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 1000; i++) {
builder.append("Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. ");
builder.append("(29 letters)\n");
builder.append("Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. ");
builder.append("(31 letters)\n");
builder.append("Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on ");
builder.append("NASAs Space Shuttle. (32 letters)\n");
builder.append("The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. ");
builder.append("(39 letters)\n");
builder.append("How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity ");
builder.append("awards at 49 letters long, but old-time Mac users may recognize it.\n");
builder.append("Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac ");
builder.append("computers after System 7.\n");
builder.append("A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my ");
builder.append("brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n");
builder.append("---\n");
}
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));
KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("RSA");
keyGenerator.initialize(1024, new SecureRandom());
KeyPair keypair = keyGenerator.generateKeyPair();
// create object
minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(), "application/octet-stream",
keypair);
bais.close();
System.out.println("my-bucketname is uploaded successfully");
}
bucketName - Bucket name.objectName - Object name to create in the bucket.stream - stream to upload.size - Size of all the data that will be uploaded.contentType - Content type of the stream.keypair - Master keypair for asymmetric encryption.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidAlgorithmParameterException - upon wrong encryption algorithm usedBadPaddingException - upon incorrect padding in a blockIllegalBlockSizeException - upon incorrect blockNoSuchPaddingException - upon wrong padding type specifiedNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionInvalidArgumentExceptionputObject(String bucketName, String objectName, String fileName, String contentType),
putObject(String bucketName, String objectName, String fileName),
putObject(String bucketName, String objectName, InputStream stream, long size, String contentType),
putObject(String bucketName, String objectName, InputStream stream, long size, String contentType, SecretKey
key)public PolicyType getBucketPolicy(String bucketName, String objectPrefix) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.objectPrefix - name of the object prefix
Example: String policy = minioClient.getBucketPolicy("my-bucketname", "my-objectname");
System.out.println(policy); InvalidBucketNameExceptionInvalidObjectPrefixExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionIOExceptionInvalidKeyExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic void setBucketPolicy(String bucketName, String objectPrefix, PolicyType policyType) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.objectPrefix - Name of the object prefix.policyType - Enum of PolicyType.
Example: setBucketPolicy("my-bucketname", "my-objectname", PolicyType.READ_ONLY); InvalidBucketNameExceptionInvalidObjectPrefixExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionIOExceptionInvalidKeyExceptionNoResponseExceptionorg.xmlpull.v1.XmlPullParserExceptionErrorResponseExceptionInternalExceptionpublic NotificationConfiguration getBucketNotification(String bucketName) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.
Example: NotificationConfiguration notificationConfig = minioClient.getBucketNotification("my-bucketname");
InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidObjectPrefixExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void setBucketNotification(String bucketName, NotificationConfiguration notificationConfiguration) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.notificationConfiguration - Notification configuration to be set.
Example: minioClient.setBucketNotification("my-bucketname", notificationConfiguration);
InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidObjectPrefixExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void removeAllBucketNotification(String bucketName) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.
Example: minioClient.removeAllBucketNotification("my-bucketname");
InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidObjectPrefixExceptionNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic Iterable<Result<Upload>> listIncompleteUploads(String bucketName) throws org.xmlpull.v1.XmlPullParserException
bucketName - Bucket name.org.xmlpull.v1.XmlPullParserExceptionlistIncompleteUploads(String, String, boolean)public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix) throws org.xmlpull.v1.XmlPullParserException
bucketName - Bucket name.prefix - filters the list of uploads to include only those that start with prefix.org.xmlpull.v1.XmlPullParserExceptionlistIncompleteUploads(String, String, boolean)public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix, boolean recursive)
Iterable<Result<Upload>> myObjects = minioClient.listIncompleteUploads("my-bucketname");
for (Result<Upload> result : myObjects) {
Upload upload = result.get();
System.out.println(upload.uploadId() + ", " + upload.objectName());
} bucketName - Bucket name.prefix - Prefix string. List objects whose name starts with `prefix`.recursive - when false, emulates a directory structure where each listing returned is either a full object
or part of the object's key up to the first '/'. All uploads with the same prefix up to the first
'/' will be merged into one entry.listIncompleteUploads(String bucketName),
listIncompleteUploads(String bucketName, String prefix)public void removeIncompleteUpload(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
minioClient.removeIncompleteUpload("my-bucketname", "my-objectname");
System.out.println("successfully removed all incomplete upload session of my-bucketname/my-objectname"); bucketName - Bucket name.objectName - Object name in the bucket.InvalidBucketNameException - upon invalid bucket name is givenNoResponseException - upon no response from serverIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorNoSuchAlgorithmExceptionInsufficientDataExceptionInvalidKeyExceptionpublic void traceOn(OutputStream traceStream)
traceStream - OutputStream for writing HTTP call tracing.traceOff()public void traceOff()
throws IOException
IOExceptiontraceOn(java.io.OutputStream)