public class ObjectMetadata extends Object implements ServerSideEncryptionResult, S3RequesterChargedResult, ObjectExpirationResult, ObjectRestoreResult, ObjectTransitionResult, Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
static String |
AES_256_SERVER_SIDE_ENCRYPTION |
Constructor and Description |
---|
ObjectMetadata() |
Modifier and Type | Method and Description |
---|---|
void |
addUserMetadata(String key,
String value)
Adds the key value pair of custom user-metadata for the associated
object.
|
ObjectMetadata |
clone()
Returns a clone of this
ObjectMetadata . |
String |
getArchiveStatus() |
String |
getCacheControl()
Gets the optional Cache-Control HTTP header which allows the user to
specify caching behavior along the HTTP request/reply chain.
|
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.
|
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.
|
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.
|
String |
getContentMD5()
Gets the base64 encoded 128-bit MD5 digest of the associated object
(content - not including headers) according to RFC 1864.
|
Long[] |
getContentRange()
Returns the content range of the object if response contains the Content-Range header.
|
String |
getContentType()
Gets the Content-Type HTTP header, which indicates the type of content
stored in the associated object.
|
String |
getETag()
The entity tag is a hash of the object.
|
Date |
getExpirationTime()
Returns the time this object will expire and be completely removed from
S3.
|
String |
getExpirationTimeRuleId()
Returns the
BucketLifecycleConfiguration rule ID for this
object's expiration, or null if it doesn't expire. |
Date |
getHttpExpiresDate()
Returns the date when the object is no longer cacheable.
|
String |
getIbmRestoredCopyStorageClass() |
String |
getIbmTransition() |
long |
getInstanceLength()
Returns the physical length of the entire object stored in S3.
|
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.
|
String |
getObjectLockLegalHoldStatus()
The Legal Hold status of the specified object.
|
String |
getObjectLockMode()
The Object Lock mode applied to this object.
|
Date |
getObjectLockRetainUntilDate()
The date and time this object's Object Lock will expire.
|
Boolean |
getOngoingRestore()
Returns the boolean value which indicates whether there is ongoing restore request.
|
Integer |
getPartCount()
Returns the value of x-amz-mp-parts-count header.
|
Map<String,Object> |
getRawMetadata()
Gets a map of the raw metadata/headers for the associated object.
|
Object |
getRawMetadataValue(String key)
Returns the raw value of the metadata/headers for the specified key.
|
String |
getReplicationStatus() |
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.
|
Date |
getRetentionExpirationDate() |
Integer |
getRetentionLegalHoldCount() |
Long |
getRetentionPeriod() |
String |
getServerSideEncryption()
Deprecated.
Replaced by
ObjectMetadata.getSSEAlgorithm() |
String |
getSSEAlgorithm()
Returns the server-side encryption algorithm when encrypting the object
using Amazon Web Services-managed keys .
|
String |
getSSECustomerAlgorithm()
Returns the server-side encryption algorithm if the object is encrypted
using customer-provided keys.
|
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.
|
String |
getStorageClass() |
String |
getTransition()
Returns the transition storage class.
|
Date |
getTransitionDate()
Returns the date at which an object will be transitioned to
archive storage.
|
Map<String,String> |
getUserMetadata()
Gets the custom user-metadata for the associated object.
|
String |
getUserMetaDataOf(String key)
Returns the value of the specified user meta datum.
|
String |
getVersionId()
Gets the version ID of the associated Amazon S3 object if available.
|
boolean |
isRequesterCharged()
Returns the AWS Key Management System encryption context used for Server Side
Encryption of the Amazon S3 object.
|
void |
setCacheControl(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(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(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(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(String md5Base64)
Sets the base64 encoded 128-bit MD5 digest of the associated object
(content - not including headers) according to RFC 1864.
|
void |
setContentType(String contentType)
Sets the Content-Type HTTP header indicating the type of content
stored in the associated object.
|
void |
setExpirationTime(Date expirationTime)
For internal use only.
|
void |
setExpirationTimeRuleId(String expirationTimeRuleId)
For internal use only.
|
void |
setHeader(String key,
Object value)
For internal use only.
|
void |
setHttpExpiresDate(Date httpExpiresDate)
Set the date when the object is no longer cacheable.
|
void |
setLastModified(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(Date restoreExpirationTime)
For internal use only.
|
void |
setRetentionExpirationDate(Date retentionExpirationDate) |
void |
setRetentionLegalHoldCount(Integer retentionLegalHoldCount) |
void |
setRetentionPeriod(Long retentionPeriod) |
void |
setServerSideEncryption(String algorithm)
Deprecated.
Replaced by
ObjectMetadata.setSSEAlgorithm(String) |
void |
setSSEAlgorithm(String algorithm)
Sets the server-side encryption algorithm when encrypting the object
using Amazon Web Services-managed keys.
|
void |
setSSECustomerAlgorithm(String algorithm)
For internal use only.
|
void |
setSSECustomerKeyMd5(String md5Digest)
For internal use only.
|
void |
setTransition(String transition)
For internal use only.
|
void |
setTransitionDate(Date transitionDate)
For internal use only.
|
void |
setUserMetadata(Map<String,String> userMetadata)
Sets the custom user-metadata for the associated object.
|
public static final String AES_256_SERVER_SIDE_ENCRYPTION
public Map<String,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.
ObjectMetadata.setUserMetadata(Map)
,
ObjectMetadata.addUserMetadata(String, String)
public void setUserMetadata(Map<String,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.ObjectMetadata.getUserMetadata()
,
ObjectMetadata.addUserMetadata(String, String)
public void setHeader(String key, Object value)
key
- The name of the header being set.value
- The value for the header.public void addUserMetadata(String key, 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.ObjectMetadata.setUserMetadata(Map)
,
ObjectMetadata.getUserMetadata()
public Map<String,Object> getRawMetadata()
public Object getRawMetadataValue(String key)
public Date getLastModified()
public void setLastModified(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 Amazon Web Services 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 https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6
null
if it hasn't been set yet.ObjectMetadata.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 Amazon Web Services 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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length
contentLength
- The Content-Length HTTP header indicating the size of the
associated object in bytes.ObjectMetadata.getContentLength()
public 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 Amazon Web Services 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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
null
if it hasn't been
set.ObjectMetadata.setContentType(String)
public void setContentType(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 Amazon Web Services 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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
contentType
- The HTTP Content-Type header indicating the type of content
stored in the associated S3 object.ObjectMetadata.getContentType()
public 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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
null
if it hasn't been set.ObjectMetadata.setContentLanguage(String)
public void setContentLanguage(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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
contentLanguage
- The HTTP Content-Language header which describes the natural language(s) of the
intended audience for the enclosed entity.ObjectMetadata.getContentLanguage()
public 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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-encoding
null
if it hasn't been set.ObjectMetadata.setContentEncoding(String)
public void setContentEncoding(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 https://www.rfc-editor.org/rfc/rfc9110.html#name-content-encoding
encoding
- The HTTP Content-Encoding header, as defined in RFC 2616.ObjectMetadata.getContentEncoding()
public 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 https://www.rfc-editor.org/rfc/rfc9111#name-cache-control
null
if
it hasn't been set.ObjectMetadata.setCacheControl(String)
public void setCacheControl(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 https://www.rfc-editor.org/rfc/rfc9111#name-cache-control
cacheControl
- The HTTP Cache-Control header as defined in RFC 2616.ObjectMetadata.getCacheControl()
public void setContentMD5(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 sometimes (but not always) represents the hex encoded 128-bit MD5 digest as computed by Amazon
S3. See the documentation at ObjectMetadata.getETag()
for more information on what the ETag field represents.
The Amazon Web Services S3 Java 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.ObjectMetadata.getContentMD5()
public 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 sometimes (but not always) represents the hex encoded 128-bit MD5 digest as computed by Amazon
S3. See the documentation at ObjectMetadata.getETag()
for more information on what the ETag field represents.
The Amazon Web Services 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.ObjectMetadata.setContentMD5(String)
public void setContentDisposition(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 https://www.rfc-editor.org/rfc/rfc2616.html#section-19.5.1
disposition
- The value for the Content-Disposition header.ObjectMetadata.getContentDisposition()
public 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 https://www.rfc-editor.org/rfc/rfc2616.html#section-19.5.1
null
if the Content-Disposition header
hasn't been set.ObjectMetadata.setCacheControl(String)
public String getETag()
null
if it hasn't been set yet.public String getVersionId()
public String getSSEAlgorithm()
getSSEAlgorithm
in interface ServerSideEncryptionResult
@Deprecated public String getServerSideEncryption()
ObjectMetadata.getSSEAlgorithm()
public void setSSEAlgorithm(String algorithm)
setSSEAlgorithm
in interface ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm when encrypting the
object using Amazon Web Services-managed keys .@Deprecated public void setServerSideEncryption(String algorithm)
ObjectMetadata.setSSEAlgorithm(String)
public String getSSECustomerAlgorithm()
getSSECustomerAlgorithm
in interface ServerSideEncryptionResult
public void setSSECustomerAlgorithm(String algorithm)
SSECustomerKey
members in request objects.setSSECustomerAlgorithm
in interface ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm used when encrypting the
object with customer-provided keys.public String getSSECustomerKeyMd5()
getSSECustomerKeyMd5
in interface ServerSideEncryptionResult
public void setSSECustomerKeyMd5(String md5Digest)
SSECustomerKey
members in request objects.setSSECustomerKeyMd5
in interface ServerSideEncryptionResult
md5Digest
- The base64-encoded MD5 digest of the encryption key for
server-side encryption.public String getIbmTransition()
public String getIbmRestoredCopyStorageClass()
public Date getExpirationTime()
getExpirationTime
in interface ObjectExpirationResult
public void setExpirationTime(Date expirationTime)
setExpirationTime
in interface ObjectExpirationResult
expirationTime
- The expiration time for the object.public String getExpirationTimeRuleId()
BucketLifecycleConfiguration
rule ID for this
object's expiration, or null if it doesn't expire.getExpirationTimeRuleId
in interface ObjectExpirationResult
BucketLifecycleConfiguration.Rule.getId()
public void setExpirationTimeRuleId(String expirationTimeRuleId)
setExpirationTimeRuleId
in interface ObjectExpirationResult
expirationTimeRuleId
- The rule ID of this object's expiration configurationpublic Date getRestoreExpirationTime()
getRestoreExpirationTime
in interface ObjectRestoreResult
public void setRestoreExpirationTime(Date restoreExpirationTime)
setRestoreExpirationTime
in interface ObjectRestoreResult
restoreExpirationTime
- The new restore expiration time for the object.public void setOngoingRestore(boolean ongoingRestore)
setOngoingRestore
in interface ObjectRestoreResult
public Boolean getOngoingRestore()
getOngoingRestore
in interface ObjectRestoreResult
public Date getTransitionDate()
getTransitionDate
in interface ObjectTransitionResult
public void setTransitionDate(Date transitionDate)
setTransitionDate
in interface ObjectTransitionResult
transitionDate
- The transition date for the object.public void setTransition(String transition)
setTransition
in interface ObjectTransitionResult
public String getTransition()
getTransition
in interface ObjectTransitionResult
public void setHttpExpiresDate(Date httpExpiresDate)
public Date getHttpExpiresDate()
public String getStorageClass()
StorageClass
for possible valuespublic String getArchiveStatus()
public String getUserMetaDataOf(String key)
public ObjectMetadata clone()
ObjectMetadata
. Note the clone of
the internal ObjectMetadata.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.public boolean isRequesterCharged()
isRequesterCharged
in interface S3RequesterChargedResult
public void setRequesterCharged(boolean isRequesterCharged)
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 S3RequesterChargedResult
isRequesterCharged
- Indicates requester is charged for this operation.public Date getRetentionExpirationDate()
public void setRetentionExpirationDate(Date retentionExpirationDate)
public Integer getRetentionLegalHoldCount()
public void setRetentionLegalHoldCount(Integer retentionLegalHoldCount)
public Long getRetentionPeriod()
public void setRetentionPeriod(Long retentionPeriod)
public 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 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 String getReplicationStatus()
public String getObjectLockMode()
public Date getObjectLockRetainUntilDate()
public String getObjectLockLegalHoldStatus()
Copyright © 2024. All rights reserved.