public 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,
ServerSideEncryption sseSource,
String destBucketName,
String destObjectName,
CopyConditions copyConditions,
ServerSideEncryption sseTarget)
Copy a source object into a new object with the provided name in the provided bucket.
|
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.
|
void |
deleteBucketLifeCycle(String bucketName)
Delete the LifeCycle of bucket.
|
String |
getBucketLifeCycle(String bucketName)
Get bucket life cycle configuration.
|
NotificationConfiguration |
getBucketNotification(String bucketName)
Get bucket notification configuration
|
String |
getBucketPolicy(String bucketName)
Get JSON string of bucket policy of the given bucket.
|
InputStream |
getObject(String bucketName,
String objectName)
Gets entire object's data as
InputStream in given bucket. |
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,
ServerSideEncryption sse)
Gets entire object's data as
InputStream in given bucket. |
void |
getObject(String bucketName,
String objectName,
ServerSideEncryption sse,
String fileName)
Gets encrypted object's data in the given bucket and stores it to given file name.
|
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.
|
String |
getPresignedObjectUrl(Method method,
String bucketName,
String objectName,
Integer expires,
Map<String,String> reqParams)
Returns a presigned URL string with given HTTP method, expiry time and custom request params for a
specific object in the bucket.
|
void |
ignoreCertCheck()
Ignores check on server certificate for HTTPS connection.
|
List<Bucket> |
listBuckets()
Returns all bucket information owned by the current user.
|
void |
listenBucketNotification(String bucketName,
String prefix,
String suffix,
String[] events,
BucketEventListener eventCallback)
Listen to bucket notifications.
|
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)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
Map<String,String> headerMap,
ServerSideEncryption sse)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
Long size,
Map<String,String> headerMap,
ServerSideEncryption sse,
String contentType)
Uploads data from given stream as object to given bucket where the stream size is unknown.
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
ServerSideEncryption sse)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
long size,
String contentType)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
Map<String,String> headerMap)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
Map<String,String> headerMap,
ServerSideEncryption sse)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
InputStream stream,
String contentType)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
String fileName)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
String fileName,
Long size,
Map<String,String> headerMap,
ServerSideEncryption sse,
String contentType)
Uploads given file as object in given bucket.
|
void |
putObject(String bucketName,
String objectName,
String fileName,
ServerSideEncryption sse)
Deprecated.
As of release 6.1
|
void |
putObject(String bucketName,
String objectName,
String fileName,
String contentType)
Deprecated.
As of release 6.1
|
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.
|
void |
removeObject(String bucketName,
String objectName)
Removes an object from a bucket.
|
Iterable<Result<DeleteError>> |
removeObjects(String bucketName,
Iterable<String> objectNames)
Removes multiple objects from a bucket.
|
void |
setAppInfo(String name,
String version)
Sets application's name/version to user agent.
|
void |
setBucketLifeCycle(String bucketName,
String lifeCycle)
Set XML string of LifeCycle on a given bucket.
|
void |
setBucketNotification(String bucketName,
NotificationConfiguration notificationConfiguration)
Set bucket notification configuration
|
void |
setBucketPolicy(String bucketName,
String policy)
Set JSON string of policy on given bucket.
|
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.
|
ObjectStat |
statObject(String bucketName,
String objectName,
ServerSideEncryption sse)
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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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.min.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.min.io:9000
* http://play.min.io:9010/
* localhost
* localhost.localdomain
* play.min.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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorObjectStatpublic ObjectStat statObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
ObjectStat objectStat = minioClient.statObject("my-bucketname", "my-objectname", sse);
System.out.println(objectStat); bucketName - Bucket name.objectName - Object name in the bucket.sse - Encryption metadata only required for SSE-C.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.ObjectStatpublic 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public void getObject(String bucketName, String objectName, ServerSideEncryption sse, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
minioClient.getObject("my-bucketname", "my-objectname", sse, "photo.jpg"); bucketName - Bucket name.objectName - Object name in the bucket.sse - encryption metadata.fileName - file name to download into.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public InputStream getObject(String bucketName, String objectName, ServerSideEncryption sse) 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", sse);
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.sse - Encryption metadata only required for SSE-C.InputStream containing the object data.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.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.InvalidKeyException - upon an invalid access key or secret keyInvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthNoResponseException - upon no response from serverErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInvalidArgumentException - upon invalid value is passed to a method.public 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.InvalidKeyException - upon an invalid access key or secret keyInvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthNoResponseException - upon no response from serverErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInvalidArgumentException - upon invalid value is passed to a method.public 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.InvalidKeyException - upon an invalid access key or secret keyInvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthNoResponseException - upon no response from serverErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInvalidArgumentException - upon invalid value is passed to a method.public 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.InvalidKeyException - upon an invalid access key or secret keyInvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthNoResponseException - upon no response from serverErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInvalidArgumentException - upon invalid value is passed to a method.public void copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, String destBucketName, String destObjectName, CopyConditions copyConditions, ServerSideEncryption sseTarget) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, org.xmlpull.v1.XmlPullParserException, InvalidArgumentException
minioClient.copyObject("my-bucketname", "my-objectname", sseSource, "my-destbucketname",
"my-destobjname", copyConditions, sseTarget);
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.sseSource - Source Encryption metadata.sseTarget - Target Encryption metadata.InvalidKeyException - upon an invalid access key or secret keyInvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthNoResponseException - upon no response from serverErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorIOException - upon connection errororg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInvalidArgumentException - upon invalid value is passed to a method.public 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 invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public String getPresignedObjectUrl(Method method, 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.getPresignedObjectUrl(Method.DELETE, "my-bucketname", "my-objectname",
60 * 60 * 24, reqParams);
System.out.println(url); method - HTTP Method.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 invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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 invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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 invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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 invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidExpiresRangeException - upon input expires is out of rangepublic 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.min.io:9000/my-bucketname"); policy - Post policy of an object.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.PostPolicypublic void removeObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
minioClient.removeObject("my-bucketname", "my-objectname"); bucketName - Bucket name.objectName - Object name in the bucket.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public Iterable<Result<DeleteError>> removeObjects(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.removeObjects("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.XmlPullParserException - upon parsing response xmlpublic 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.XmlPullParserException - upon parsing response xmlpublic 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());
} InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading givenIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading givenIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful execution.ErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInsufficientDataException - upon getting EOFException while reading givenRegionConflictExceptionpublic 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 givenRegionConflictException - upon passed region conflicts with the one
previously specified.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInsufficientDataException - upon getting EOFException while reading givenpublic 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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort all the uploaded content.
bucketName - Bucket name.objectName - Object name to create in the bucket.fileName - File name to upload.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, String fileName, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, abort the uploaded parts automatically.
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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, String fileName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
bucketName - Bucket name.objectName - Object name to create in the bucket.fileName - File name to upload.sse - encryption metadata.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading givenpublic void putObject(String bucketName, String objectName, String fileName, Long size, Map<String,String> headerMap, ServerSideEncryption sse, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, abort the uploaded parts automatically.
bucketName - Bucket name.objectName - Object name to create in the bucket.fileName - File name to upload.size - Size of all the data that will be uploaded.headerMap - Custom/additional meta data of the object.sse - encryption metadata.contentType - Content type of the stream.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, long size, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, Map<String,String> headerMap) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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, 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.headerMap - Custom/additional meta data of the object.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, long size, Map<String,String> headerMap) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, long size, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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.sse - encryption metadata.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, Map<String,String> headerMap, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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");
headerMap.put("X-Amz-Meta-Key", "meta-data");
//Generate symmetric 256 bit AES key.
KeyGenerator symKeyGenerator = KeyGenerator.getInstance("AES");
symKeyGenerator.init(256);
SecretKey symKey = symKeyGenerator.generateKey();
minioClient.putObject("my-bucketname", "my-objectname", bais, headerMap, symKey);
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.headerMap - Custom/additional meta data of the object.sse - encryption metadata.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, long size, Map<String,String> headerMap, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automatically.
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");
headerMap.put("X-Amz-Meta-Key", "meta-data");
//Generate symmetric 256 bit AES key.
KeyGenerator symKeyGenerator = KeyGenerator.getInstance("AES");
symKeyGenerator.init(256);
SecretKey symKey = symKeyGenerator.generateKey();
minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(), headerMap, symKey);
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.headerMap - Custom/additional meta data of the object.sse - encryption metadata.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.InsufficientDataException - upon getting EOFException while reading given@Deprecated public void putObject(String bucketName, String objectName, InputStream stream, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automaticlly.
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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public void putObject(String bucketName, String objectName, InputStream stream, Long size, Map<String,String> headerMap, ServerSideEncryption sse, String contentType) throws InvalidBucketNameException, NoSuchAlgorithmException, 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.
If the multipart session fails, we abort the uploaded parts automaticlly.
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");
headerMap.put("X-Amz-Meta-Key", "meta-data");
//Generate symmetric 256 bit AES key.
KeyGenerator symKeyGenerator = KeyGenerator.getInstance("AES");
symKeyGenerator.init(256);
SecretKey symKey = symKeyGenerator.generateKey();
minioClient.putObject("my-bucketname", "my-objectname", bais, bais.available(), headerMap, symKey);
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.sse - encryption metadata.contentType - Content type of the stream.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.putObject(String bucketName, String objectName, String fileName)public String getBucketPolicy(String bucketName) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, BucketPolicyTooLargeException
bucketName - the name of the bucket for which policies are to be listed.
Example:
String policyString = minioClient.getBucketPolicy("my-bucketname");
InvalidBucketNameException - upon an invalid bucket nameIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon insufficient dataNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlInternalException - upon internal library errorErrorResponseException - upon unsuccessful executionInvalidBucketNameException - upon invalid bucket name is givenInvalidObjectPrefixException - upon invalid object prefix.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorBucketPolicyTooLargeException - upon bucket policy too large in sizepublic void setBucketPolicy(String bucketName, String policy) throws InvalidBucketNameException, InvalidObjectPrefixException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.policy - Bucket policy JSON string.
Example: StringBuilder builder = new StringBuilder();
builder.append("{\n");
builder.append(" \"Statement\": [\n");
builder.append(" {\n");
builder.append(" \"Action\": [\n");
builder.append(" \"s3:GetBucketLocation\",\n");
builder.append(" \"s3:ListBucket\"\n");
builder.append(" ],\n");
builder.append(" \"Effect\": \"Allow\",\n");
builder.append(" \"Principal\": \"*\",\n");
builder.append(" \"Resource\": \"arn:aws:s3:::my-bucketname\"\n");
builder.append(" },\n");
builder.append(" {\n");
builder.append(" \"Action\": \"s3:GetObject\",\n");
builder.append(" \"Effect\": \"Allow\",\n");
builder.append(" \"Principal\": \"*\",\n");
builder.append(" \"Resource\": \"arn:aws:s3:::my-bucketname/myobject*\"\n");
builder.append(" }\n");
builder.append(" ],\n");
builder.append(" \"Version\": \"2012-10-17\"\n");
builder.append("}\n");
setBucketPolicy("my-bucketname", builder.toString()); InvalidBucketNameException - upon invalid bucket name is givenInvalidObjectPrefixException - upon invalid object prefix.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library error *public void setBucketLifeCycle(String bucketName, String lifeCycle) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException
bucketName - Bucket name.lifeCycle - Bucket policy XML string.
Example: String lifecycle = "<LifecycleConfiguration><Rule><ID>expire-bucket</ID><Prefix></Prefix>"
+ "<Status>Enabled</Status><Expiration><Days>365</Days></Expiration></Rule></LifecycleConfiguration>";
setBucketLifecycle("my-bucketname", lifecycle); InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during
signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorInvalidArgumentException - upon invalid value is passed to a method.public void deleteBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.
Example: deleteBucketLifeCycle("my-bucketname"); InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during
signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic String getBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.
Example: String bucketLifeCycle = minioClient.getBucketLifecycle("my-bucketname");
InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during
signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenInvalidObjectPrefixException - upon invalid object prefix.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenInvalidObjectPrefixException - upon invalid object prefix.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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 givenInvalidObjectPrefixException - upon invalid object prefix.NoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic 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.XmlPullParserException - upon parsing response xmllistIncompleteUploads(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 givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic void listenBucketNotification(String bucketName, String prefix, String suffix, String[] events, BucketEventListener eventCallback) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, org.xmlpull.v1.XmlPullParserException, ErrorResponseException, InternalException
bucketName - Bucket name.prefix - Prefix of concerned objects events.suffix - Suffix of concerned objects events.events - List of events to watch.eventCallback - Event handler.InvalidBucketNameException - upon invalid bucket name is givenNoSuchAlgorithmException - upon requested algorithm was not found during signature calculationInsufficientDataException - upon getting EOFException while reading given
InputStream even before reading given lengthIOException - upon connection errorInvalidKeyException - upon an invalid access key or secret keyNoResponseException - upon no response from serverorg.xmlpull.v1.XmlPullParserException - upon parsing response xmlErrorResponseException - upon unsuccessful executionInternalException - upon internal library errorpublic void traceOn(OutputStream traceStream)
traceStream - OutputStream for writing HTTP call tracing.traceOff()public void traceOff()
throws IOException
IOException - upon connection errortraceOn(java.io.OutputStream)