public class S3Object extends StorageObject implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
S3_VERSION_ID |
static java.lang.String |
SERVER_SIDE_ENCRYPTION__AES256 |
static java.lang.String |
SERVER_SIDE_ENCRYPTION__NONE |
static java.lang.String |
STORAGE_CLASS_GLACIER |
static java.lang.String |
STORAGE_CLASS_REDUCED_REDUNDANCY |
static java.lang.String |
STORAGE_CLASS_STANDARD |
acl, bucketName, dataInputFile, dataInputStream, isMetadataComplete, METADATA_HEADER_HASH_MD5, METADATA_HEADER_ORIGINAL_HASH_MD5, METADATA_HEADER_SERVER_SIDE_ENCRYPTION, serverSideEncryptionAlgorithm, storageClass
METADATA_HEADER_CONTENT_DISPOSITION, METADATA_HEADER_CONTENT_ENCODING, METADATA_HEADER_CONTENT_LANGUAGE, METADATA_HEADER_CONTENT_LENGTH, METADATA_HEADER_CONTENT_MD5, METADATA_HEADER_CONTENT_TYPE, METADATA_HEADER_CREATION_DATE, METADATA_HEADER_DATE, METADATA_HEADER_ETAG, METADATA_HEADER_LAST_MODIFIED_DATE
Constructor and Description |
---|
S3Object()
Create an object without any associated information whatsoever.
|
S3Object(java.io.File file)
Create an object representing a file.
|
S3Object(S3Bucket bucket,
java.io.File file)
Create an object representing a file.
|
S3Object(S3Bucket bucket,
java.lang.String key)
Create an object without any associated data.
|
S3Object(S3Bucket bucket,
java.lang.String key,
java.lang.String dataString)
Create an object representing text data.
|
S3Object(java.lang.String key)
Create an object without any associated data, and no associated bucket.
|
S3Object(java.lang.String key,
byte[] data)
Create an object representing binary data.
|
S3Object(java.lang.String key,
java.lang.String dataString)
Create an object representing text data.
|
Modifier and Type | Method and Description |
---|---|
static S3Object[] |
cast(StorageObject[] objects) |
java.lang.Object |
clone() |
java.lang.String |
getVersionId() |
void |
setAcl(AccessControlList acl)
Set the object's ACL.
|
void |
setSHA256Hash(byte[] hash) |
java.lang.String |
toString() |
addAllMetadata, addMetadata, closeDataInputStream, getAcl, getBucketName, getContentDisposition, getContentEncoding, getContentLanguage, getContentLength, getContentType, getDataInputFile, getDataInputStream, getETag, getKey, getLastModifiedDate, getMd5HashAsBase64, getMd5HashAsHex, getModifiableMetadata, getServerSideEncryptionAlgorithm, getStorageClass, isDirectoryPlaceholder, isMetadataComplete, setBucketName, setContentDisposition, setContentEncoding, setContentLanguage, setContentLength, setContentType, setDataInputFile, setDataInputStream, setETag, setKey, setLastModifiedDate, setMd5Hash, setMetadataComplete, setServerSideEncryptionAlgorithm, setStorageClass, verifyData, verifyData, verifyData
addMetadata, addMetadata, addMetadata, containsMetadata, getCompleteMetadataMap, getHttpMetadata, getHttpMetadataMap, getMetadata, getMetadataCaseInsensitiveFromMap, getMetadataMap, getName, getOwner, getServiceMetadata, getServiceMetadataMap, getUserMetadata, getUserMetadataMap, isMatchingMetadataName, lookupMetadataSubsetMap, removeMetadata, replaceAllMetadata, setName, setOwner
public static final java.lang.String STORAGE_CLASS_STANDARD
public static final java.lang.String STORAGE_CLASS_REDUCED_REDUNDANCY
public static final java.lang.String STORAGE_CLASS_GLACIER
public static final java.lang.String SERVER_SIDE_ENCRYPTION__NONE
public static final java.lang.String SERVER_SIDE_ENCRYPTION__AES256
public static final java.lang.String S3_VERSION_ID
public S3Object(S3Bucket bucket, java.io.File file) throws java.security.NoSuchAlgorithmException, java.io.IOException
Mimetypes
), and a content length matching the file's size.
The file's MD5 hash value is also calculated and provided to S3, so the service
can verify that no data are corrupted in transit.
NOTE: The automatic calculation of a file's MD5 hash digest as performed by this constructor could take some time for large files, or for many small ones.
bucket
- the bucket the object belongs to, or will be placed in.file
- the file the object will represent. This file must exist and be readable.java.io.IOException
- when an i/o error occurred reading the filejava.security.NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithmpublic S3Object(java.io.File file) throws java.security.NoSuchAlgorithmException, java.io.IOException
Mimetypes
), and a content length matching the file's size.
The file's MD5 hash value is also calculated and provided to S3, so the service
can verify that no data are corrupted in transit.
NOTE: The automatic calculation of a file's MD5 hash digest as performed by this constructor could take some time for large files, or for many small ones.
file
- the file the object will represent. This file must exist and be readable.java.io.IOException
- when an i/o error occurred reading the filejava.security.NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithmpublic S3Object(S3Bucket bucket, java.lang.String key, java.lang.String dataString) throws java.security.NoSuchAlgorithmException, java.io.IOException
text/plain; charset=utf-8
, and a content length matching the
string's length.
The given string's MD5 hash value is also calculated and provided to S3, so the service
can verify that no data are corrupted in transit.
NOTE: The automatic calculation of the MD5 hash digest as performed by this constructor could take some time for large strings, or for many small ones.
bucket
- the bucket the object belongs to, or will be placed in.key
- the key name for the object.dataString
- the text data the object will contain. Text data will be encoded as UTF-8.
This string cannot be null.java.io.IOException
java.security.NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithmpublic S3Object(java.lang.String key, java.lang.String dataString) throws java.security.NoSuchAlgorithmException, java.io.IOException
text/plain; charset=utf-8
, and a content length matching the
string's length.
The given string's MD5 hash value is also calculated and provided to S3, so the service
can verify that no data are corrupted in transit.
NOTE: The automatic calculation of the MD5 hash digest as performed by this constructor could take some time for large strings, or for many small ones.
key
- the key name for the object.dataString
- the text data the object will contain. Text data will be encoded as UTF-8.
This string cannot be null.java.io.IOException
java.security.NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithmpublic S3Object(java.lang.String key, byte[] data) throws java.security.NoSuchAlgorithmException, java.io.IOException
application/octet-stream
, and a content length matching the
byte array's length.
The MD5 hash value of the byte data is also calculated and provided to the target
service, so the service can verify that no data are corrupted in transit.key
- the key name for the object.data
- the byte data the object will contain, cannot be null.java.io.IOException
java.security.NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithmpublic S3Object(java.lang.String key)
key
- the key name for the object.public S3Object(S3Bucket bucket, java.lang.String key)
bucket
- the bucket the object belongs to, or will be placed in.key
- the key name for the object.public S3Object()
public java.lang.String toString()
toString
in class StorageObject
public void setSHA256Hash(byte[] hash)
public void setAcl(AccessControlList acl)
x-amz-acl
.setAcl
in class StorageObject
acl
- public java.lang.String getVersionId()
public java.lang.Object clone()
clone
in class StorageObject
public static S3Object[] cast(StorageObject[] objects)