public class ObjectMetadata
extends java.lang.Object
implements com.amazonaws.services.s3.internal.ServerSideEncryptionResult, com.amazonaws.services.s3.internal.S3RequesterChargedResult, com.amazonaws.services.s3.internal.ObjectExpirationResult, com.amazonaws.services.s3.internal.ObjectRestoreResult, java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AES_256_SERVER_SIDE_ENCRYPTION |
static java.lang.String |
KMS_SERVER_SIDE_ENCRYPTION |
Constructor and Description |
---|
ObjectMetadata() |
Modifier and Type | Method and Description |
---|---|
void |
addUserMetadata(java.lang.String key,
java.lang.String value)
Adds the key value pair of custom user-metadata for the associated
object.
|
ObjectMetadata |
clone()
Returns a clone of this
ObjectMetadata . |
java.lang.String |
getCacheControl()
Gets the optional Cache-Control HTTP header which allows the user to
specify caching behavior along the HTTP request/reply chain.
|
java.lang.String |
getContentDisposition()
Gets the optional Content-Disposition HTTP header, which specifies
presentation information for the object such as the recommended filename
for the object to be saved as.
|
java.lang.String |
getContentEncoding()
Gets the optional Content-Encoding HTTP header specifying what content
encodings have been applied to the object and what decoding mechanisms
must be applied in order to obtain the media-type referenced by the
Content-Type field.
|
java.lang.String |
getContentLanguage()
Gets the Content-Language HTTP header, which describes the natural language(s) of the
intended audience for the enclosed entity.
|
long |
getContentLength()
Gets the Content-Length HTTP header indicating the size of the associated
object in bytes.
|
java.lang.String |
getContentMD5()
Gets the base64 encoded 128-bit MD5 digest of the associated object
(content - not including headers) according to RFC 1864.
|
java.lang.Long[] |
getContentRange()
Returns the content range of the object if response contains the Content-Range header.
|
java.lang.String |
getContentType()
Gets the Content-Type HTTP header, which indicates the type of content
stored in the associated object.
|
java.lang.String |
getETag()
Gets the hex encoded 128-bit MD5 digest of the associated object
according to RFC 1864.
|
java.util.Date |
getExpirationTime()
Returns the time this object will expire and be completely removed from
S3.
|
java.lang.String |
getExpirationTimeRuleId()
Returns the
BucketLifecycleConfiguration rule ID for this
object's expiration, or null if it doesn't expire. |
java.util.Date |
getHttpExpiresDate()
Returns the date when the object is no longer cacheable.
|
long |
getInstanceLength()
Returns the physical length of the entire object stored in S3.
|
java.util.Date |
getLastModified()
Gets the value of the Last-Modified header, indicating the date and time
at which Amazon S3 last recorded a modification to the associated object.
|
java.lang.Boolean |
getOngoingRestore()
Returns the boolean value which indicates whether there is ongoing
restore request.
|
java.lang.Integer |
getPartCount()
Returns the value of x-amz-mp-parts-count header.
|
java.util.Map<java.lang.String,java.lang.Object> |
getRawMetadata()
For internal use only.
|
java.lang.Object |
getRawMetadataValue(java.lang.String key)
For internal use only.
|
java.lang.String |
getReplicationStatus() |
java.util.Date |
getRestoreExpirationTime()
Returns the time at which an object that has been temporarily restored
from Amazon Glacier will expire, and will need to be restored again in
order to be accessed.
|
java.lang.String |
getServerSideEncryption()
Deprecated.
Replaced by
getSSEAlgorithm() |
java.lang.String |
getSSEAlgorithm()
Returns the server-side encryption algorithm when encrypting the object
using AWS-managed keys .
|
java.lang.String |
getSSEAwsKmsKeyId()
Returns the AWS Key Management System key id used for Server Side
Encryption of the Amazon S3 object.
|
java.lang.String |
getSSECustomerAlgorithm()
Returns the server-side encryption algorithm if the object is encrypted
using customer-provided keys.
|
java.lang.String |
getSSECustomerKeyMd5()
Returns the base64-encoded MD5 digest of the encryption key for
server-side encryption, if the object is encrypted using
customer-provided keys.
|
java.lang.String |
getStorageClass() |
java.util.Map<java.lang.String,java.lang.String> |
getUserMetadata()
Gets the custom user-metadata for the associated object.
|
java.lang.String |
getUserMetaDataOf(java.lang.String key)
Returns the value of the specified user meta datum.
|
java.lang.String |
getVersionId()
Gets the version ID of the associated Amazon S3 object if available.
|
boolean |
isRequesterCharged()
Returns true if the user has enabled Requester Pays option when
conducting this operation from Requester Pays Bucket; else false.
|
void |
setCacheControl(java.lang.String cacheControl)
Sets the optional Cache-Control HTTP header which allows the user to
specify caching behavior along the HTTP request/reply chain.
|
void |
setContentDisposition(java.lang.String disposition)
Sets the optional Content-Disposition HTTP header, which specifies
presentational information such as the recommended filename for the
object to be saved as.
|
void |
setContentEncoding(java.lang.String encoding)
Sets the optional Content-Encoding HTTP header specifying what content
encodings have been applied to the object and what decoding mechanisms
must be applied in order to obtain the media-type referenced by the
Content-Type field.
|
void |
setContentLanguage(java.lang.String contentLanguage)
Sets the Content-Language HTTP header which describes the natural language(s) of the
intended audience for the enclosed entity.
|
void |
setContentLength(long contentLength)
Sets the Content-Length HTTP header indicating the size of the associated
object in bytes.
|
void |
setContentMD5(java.lang.String md5Base64)
Sets the base64 encoded 128-bit MD5 digest of the associated object
(content - not including headers) according to RFC 1864.
|
void |
setContentType(java.lang.String contentType)
Sets the Content-Type HTTP header indicating the type of content stored
in the associated object.
|
void |
setExpirationTime(java.util.Date expirationTime)
For internal use only.
|
void |
setExpirationTimeRuleId(java.lang.String expirationTimeRuleId)
Sets the
BucketLifecycleConfiguration rule ID for this object's
expiration |
void |
setHeader(java.lang.String key,
java.lang.Object value)
For internal use only.
|
void |
setHttpExpiresDate(java.util.Date httpExpiresDate)
Set the date when the object is no longer cacheable.
|
void |
setLastModified(java.util.Date lastModified)
For internal use only.
|
void |
setOngoingRestore(boolean ongoingRestore)
For internal use only.
|
void |
setRequesterCharged(boolean isRequesterCharged)
Used for conducting this operation from a Requester Pays Bucket.
|
void |
setRestoreExpirationTime(java.util.Date restoreExpirationTime)
For internal use only.
|
void |
setServerSideEncryption(java.lang.String algorithm)
Deprecated.
Replaced by
#setSSEAlgorithm(String)) |
void |
setSSEAlgorithm(java.lang.String algorithm)
Sets the server-side encryption algorithm when encrypting the object
using AWS-managed keys.
|
void |
setSSECustomerAlgorithm(java.lang.String algorithm)
For internal use only.
|
void |
setSSECustomerKeyMd5(java.lang.String md5Digest)
For internal use only.
|
void |
setStorageClass(StorageClass storageClass)
Sets the Amazon S3 storage class for the stored objects.
|
void |
setUserMetadata(java.util.Map<java.lang.String,java.lang.String> userMetadata)
Sets the custom user-metadata for the associated object.
|
public static final java.lang.String AES_256_SERVER_SIDE_ENCRYPTION
public static final java.lang.String KMS_SERVER_SIDE_ENCRYPTION
public java.util.Map<java.lang.String,java.lang.String> getUserMetadata()
Gets the custom user-metadata for the associated object.
Amazon S3 can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-amz-meta-". Use user-metadata to store arbitrary metadata alongside their data in Amazon S3. When setting user metadata, callers should not include the internal "x-amz-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-amz-meta-" header prefix.
User-metadata keys are case insensitive and will be returned as lowercase strings, even if they were originally specified with uppercase strings.
Note that user-metadata for an object is limited by the HTTP request header limit. All HTTP headers included in a request (including user metadata headers and other standard HTTP headers) must be less than 8KB.
setUserMetadata(Map)
,
addUserMetadata(String, String)
public void setUserMetadata(java.util.Map<java.lang.String,java.lang.String> userMetadata)
Sets the custom user-metadata for the associated object.
Amazon S3 can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-amz-meta-". Use user-metadata to store arbitrary metadata alongside their data in Amazon S3. When setting user metadata, callers should not include the internal "x-amz-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-amz-meta-" header prefix.
User-metadata keys are case insensitive and will be returned as lowercase strings, even if they were originally specified with uppercase strings.
Note that user-metadata for an object is limited by the HTTP request header limit. All HTTP headers included in a request (including user metadata headers and other standard HTTP headers) must be less than 8KB.
userMetadata
- The custom user-metadata for the associated object.
Note that the key should not include the internal S3 HTTP
header prefix.getUserMetadata()
,
addUserMetadata(String, String)
public void setHeader(java.lang.String key, java.lang.Object value)
key
- The name of the header being set.value
- The value for the header.public void addUserMetadata(java.lang.String key, java.lang.String value)
Adds the key value pair of custom user-metadata for the associated object. If the entry in the custom user-metadata map already contains the specified key, it will be replaced with these new contents.
Amazon S3 can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-amz-meta-". Use user-metadata to store arbitrary metadata alongside their data in Amazon S3. When setting user metadata, callers should not include the internal "x-amz-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-amz-meta-" header prefix.
Note that user-metadata for an object is limited by the HTTP request header limit. All HTTP headers included in a request (including user metadata headers and other standard HTTP headers) must be less than 8KB.
key
- The key for the custom user metadata entry. Note that the key
should not include the internal S3 HTTP header prefix.value
- The value for the custom user-metadata entry.setUserMetadata(Map)
,
getUserMetadata()
public java.util.Map<java.lang.String,java.lang.Object> getRawMetadata()
public java.lang.Object getRawMetadataValue(java.lang.String key)
public java.util.Date getLastModified()
null
if the
Last-Modified header hasn't been set.public void setLastModified(java.util.Date lastModified)
lastModified
- The date and time at which Amazon S3 last recorded a
modification to the associated object.public long getContentLength()
Gets the Content-Length HTTP header indicating the size of the associated object in bytes.
This field is required when uploading objects to S3, but the AWS S3 Java client will automatically set it when working directly with files. When uploading directly from a stream, set this field if possible. Otherwise the client must buffer the entire stream in order to calculate the content length before sending the data to Amazon S3.
For more information on the Content-Length HTTP header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
null
if it
hasn't been set yet.setContentLength(long)
public long getInstanceLength()
public void setContentLength(long contentLength)
Sets the Content-Length HTTP header indicating the size of the associated object in bytes.
This field is required when uploading objects to S3, but the AWS S3 Java client will automatically set it when working directly with files. When uploading directly from a stream, set this field if possible. Otherwise the client must buffer the entire stream in order to calculate the content length before sending the data to Amazon S3.
For more information on the Content-Length HTTP header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
contentLength
- The Content-Length HTTP header indicating the size
of the associated object in bytes.getContentLength()
public java.lang.String getContentType()
Gets the Content-Type HTTP header, which indicates the type of content stored in the associated object. The value of this header is a standard MIME type.
When uploading files, the AWS S3 Java client will attempt to determine the correct content type if one hasn't been set yet. Users are responsible for ensuring a suitable content type is set when uploading streams. If no content type is provided and cannot be determined by the filename, the default content type, "application/octet-stream", will be used.
For more information on the Content-Type header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
null
if
it hasn't been set.setContentType(String)
public void setContentType(java.lang.String contentType)
Sets the Content-Type HTTP header indicating the type of content stored in the associated object. The value of this header is a standard MIME type.
When uploading files, the AWS S3 Java client will attempt to determine the correct content type if one hasn't been set yet. Users are responsible for ensuring a suitable content type is set when uploading streams. If no content type is provided and cannot be determined by the filename, the default content type "application/octet-stream" will be used.
For more information on the Content-Type header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
contentType
- The HTTP Content-Type header indicating the type of
content stored in the associated S3 object.getContentType()
public java.lang.String getContentLanguage()
Gets the Content-Language HTTP header, which describes the natural language(s) of the intended audience for the enclosed entity.
For more information on the Content-Type header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
null
if it hasn't been set.setContentLanguage(String)
public void setContentLanguage(java.lang.String contentLanguage)
Sets the Content-Language HTTP header which describes the natural language(s) of the intended audience for the enclosed entity.
For more information on the Content-Type header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
contentLanguage
- The HTTP Content-Language header which describes the natural language(s) of the
intended audience for the enclosed entity.getContentLanguage()
public java.lang.String getContentEncoding()
Gets the optional Content-Encoding HTTP header specifying what content encodings have been applied to the object and what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type field.
For more information on how the Content-Encoding HTTP header works, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
null
if it
hasn't been set.setContentType(String)
public void setContentEncoding(java.lang.String encoding)
Sets the optional Content-Encoding HTTP header specifying what content encodings have been applied to the object and what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type field.
For more information on how the Content-Encoding HTTP header works, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
encoding
- The HTTP Content-Encoding header, as defined in RFC 2616.getContentType()
public java.lang.String getCacheControl()
Gets the optional Cache-Control HTTP header which allows the user to specify caching behavior along the HTTP request/reply chain.
For more information on how the Cache-Control HTTP header affects HTTP requests and responses, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
null
if it hasn't been set.setCacheControl(String)
public void setCacheControl(java.lang.String cacheControl)
Sets the optional Cache-Control HTTP header which allows the user to specify caching behavior along the HTTP request/reply chain.
For more information on how the Cache-Control HTTP header affects HTTP requests and responses see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
cacheControl
- The HTTP Cache-Control header as defined in RFC 2616.getCacheControl()
public void setContentMD5(java.lang.String md5Base64)
Sets the base64 encoded 128-bit MD5 digest of the associated object (content - not including headers) according to RFC 1864. This data is used as a message integrity check to verify that the data received by Amazon S3 is the same data that the caller sent. If set to null,then the MD5 digest is removed from the metadata.
This field represents the base64 encoded 128-bit MD5 digest digest of an object's content as calculated on the caller's side. The ETag metadata field represents the hex encoded 128-bit MD5 digest as computed by Amazon S3.
The AWS S3 Android client will attempt to calculate this field automatically when uploading files to Amazon S3.
md5Base64
- The base64 encoded MD5 hash of the content for the
object associated with this metadata.getContentMD5()
public java.lang.String getContentMD5()
Gets the base64 encoded 128-bit MD5 digest of the associated object (content - not including headers) according to RFC 1864. This data is used as a message integrity check to verify that the data received by Amazon S3 is the same data that the caller sent.
This field represents the base64 encoded 128-bit MD5 digest digest of an object's content as calculated on the caller's side. The ETag metadata field represents the hex encoded 128-bit MD5 digest as computed by Amazon S3.
The AWS S3 Java client will attempt to calculate this field automatically when uploading files to Amazon S3.
null
if the MD5 hash of the content
hasn't been set.setContentMD5(String)
public void setContentDisposition(java.lang.String disposition)
Sets the optional Content-Disposition HTTP header, which specifies presentational information such as the recommended filename for the object to be saved as.
For more information on how the Content-Disposition header affects HTTP client behavior, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
disposition
- The value for the Content-Disposition header.getContentDisposition()
public java.lang.String getContentDisposition()
Gets the optional Content-Disposition HTTP header, which specifies presentation information for the object such as the recommended filename for the object to be saved as.
For more information on how the Content-Disposition header affects HTTP client behavior, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
null
if the Content-Disposition header hasn't been
set.setCacheControl(String)
public java.lang.String getETag()
This field represents the hex encoded 128-bit MD5 digest of an object's content as calculated by Amazon S3. The ContentMD5 field represents the base64 encoded 128-bit MD5 digest as calculated on the caller's side.
null
if it
hasn't been set yet.public java.lang.String getVersionId()
public java.lang.String getSSEAlgorithm()
getSSEAlgorithm
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
@Deprecated public java.lang.String getServerSideEncryption()
getSSEAlgorithm()
public void setSSEAlgorithm(java.lang.String algorithm)
setSSEAlgorithm
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm when encrypting the
object using AWS-managed keys .@Deprecated public void setServerSideEncryption(java.lang.String algorithm)
#setSSEAlgorithm(String))
public java.lang.String getSSECustomerAlgorithm()
getSSECustomerAlgorithm
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
public void setSSECustomerAlgorithm(java.lang.String algorithm)
SSECustomerKey
members in request objects.setSSECustomerAlgorithm
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm used when
encrypting the object with customer-provided keys.public java.lang.String getSSECustomerKeyMd5()
getSSECustomerKeyMd5
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
public void setSSECustomerKeyMd5(java.lang.String md5Digest)
SSECustomerKey
members in request objects.setSSECustomerKeyMd5
in interface com.amazonaws.services.s3.internal.ServerSideEncryptionResult
md5Digest
- The base64-encoded MD5 digest of the encryption key for
server-side encryption.public java.util.Date getExpirationTime()
getExpirationTime
in interface com.amazonaws.services.s3.internal.ObjectExpirationResult
public void setExpirationTime(java.util.Date expirationTime)
setExpirationTime
in interface com.amazonaws.services.s3.internal.ObjectExpirationResult
expirationTime
- The expiration time for the object.public java.lang.String getExpirationTimeRuleId()
BucketLifecycleConfiguration
rule ID for this
object's expiration, or null if it doesn't expire.getExpirationTimeRuleId
in interface com.amazonaws.services.s3.internal.ObjectExpirationResult
BucketLifecycleConfiguration.Rule.getId()
public void setExpirationTimeRuleId(java.lang.String expirationTimeRuleId)
BucketLifecycleConfiguration
rule ID for this object's
expirationsetExpirationTimeRuleId
in interface com.amazonaws.services.s3.internal.ObjectExpirationResult
expirationTimeRuleId
- The rule ID for this object's expirationpublic java.util.Date getRestoreExpirationTime()
getRestoreExpirationTime
in interface com.amazonaws.services.s3.internal.ObjectRestoreResult
public void setRestoreExpirationTime(java.util.Date restoreExpirationTime)
setRestoreExpirationTime
in interface com.amazonaws.services.s3.internal.ObjectRestoreResult
restoreExpirationTime
- The new restore expiration time for the
object.public void setOngoingRestore(boolean ongoingRestore)
setOngoingRestore
in interface com.amazonaws.services.s3.internal.ObjectRestoreResult
ongoingRestore
- boolean which indicates if there is an ongoing restore.public java.lang.Boolean getOngoingRestore()
getOngoingRestore
in interface com.amazonaws.services.s3.internal.ObjectRestoreResult
public void setHttpExpiresDate(java.util.Date httpExpiresDate)
public java.util.Date getHttpExpiresDate()
public void setStorageClass(StorageClass storageClass)
storageClass
- The Amazon S3 storage class for the stored objects.public java.lang.String getStorageClass()
StorageClass
for possible valuespublic java.lang.String getUserMetaDataOf(java.lang.String key)
public ObjectMetadata clone()
ObjectMetadata
. Note the clone of
the internal metadata
is limited to a shallow copy due to the
unlimited type of value in the map. Other fields can be regarded as deep
clone.clone
in class java.lang.Object
public java.lang.String getSSEAwsKmsKeyId()
public boolean isRequesterCharged()
com.amazonaws.services.s3.internal.S3RequesterChargedResult
If a bucket is enabled for Requester Pays, then any attempt of operation from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.
Enabling Requester Pays disables the ability to have anonymous access to this bucket
isRequesterCharged
in interface com.amazonaws.services.s3.internal.S3RequesterChargedResult
public void setRequesterCharged(boolean isRequesterCharged)
com.amazonaws.services.s3.internal.S3RequesterChargedResult
If a bucket is enabled for Requester Pays, then any attempt of operation from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.
setRequesterCharged
in interface com.amazonaws.services.s3.internal.S3RequesterChargedResult
isRequesterCharged
- Indicates requester is charged for this
operation.public java.lang.Integer getPartCount()
Returns the value of x-amz-mp-parts-count header.
The x-amz-mp-parts-count header is returned in the response only when a valid partNumber is specified in the request and the object has more than 1 part.
To find the part count of an object, set the partNumber to 1 in GetObjectRequest. If the object has more than 1 part then part count will be returned, otherwise null is returned.
public java.lang.Long[] getContentRange()
Returns the content range of the object if response contains the Content-Range header.
If the request specifies a range or part number, then response returns the Content-Range range header. Otherwise, the response does not return Content-Range header.
public java.lang.String getReplicationStatus()
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.