public class ObjectMetadata extends CosServiceResult implements ServerSideEncryptionResult, ObjectExpirationResult, ObjectRestoreResult, Cloneable, Serializable
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() |
String |
getCacheControl()
Gets the optional Cache-Control HTTP header which allows the user to specify caching behavior
along the HTTP request/reply chain.
|
CIUploadResult |
getCiUploadResult() |
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.
|
String |
getContentType()
Gets the Content-Type HTTP header, which indicates the type of content stored in the
associated object.
|
String |
getCrc64Ecma() |
String |
getETag()
Gets the hex encoded 128-bit MD5 digest of the associated object according to RFC 1864.
|
Date |
getExpirationTime()
Returns the time this object will expire and be completely removed from COS.
|
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.
|
long |
getInstanceLength()
Returns the physical length of the entire object stored in COS.
|
Date |
getLastModified()
Gets the value of the Last-Modified header, indicating the date and time at which Qcloud COS
last recorded a modification to the associated object.
|
Boolean |
getOngoingRestore()
Returns the boolean value which indicates whether there is ongoing restore request.
|
Map<String,Object> |
getRawMetadata()
For internal use only.
|
Object |
getRawMetadataValue(String key)
For internal use only.
|
String |
getRequestId()
get requestid for this upload
|
Date |
getRestoreExpirationTime()
Returns the time at which an object that has been temporarily restored from CAS will expire,
and will need to be restored again in order to be accessed.
|
String |
getServerSideEncryption()
Returns the server-side encryption algorithm for the object, or null if none was used.
|
String |
getSSEAlgorithm()
Returns the server-side encryption algorithm if the object is encrypted
using COS-managed keys.
|
String |
getSSECOSKmsKeyId()
Returns the Key Management System key id used for Server Side Encryption of the COS
object.
|
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() |
StorageClass |
getStorageClassEnum() |
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 Qcloud COS object if available.
|
boolean |
isDeleteMarker() |
boolean |
isFileModeDir() |
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 |
setCiUploadResult(CIUploadResult ciUploadResult) |
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 |
setDeleteMarker(boolean isDeleteMarker) |
void |
setETag(String etagValve) |
void |
setExpirationTime(Date expirationTime)
For internal use only.
|
void |
setExpirationTimeRuleId(String expirationTimeRuleId)
Sets the
BucketLifecycleConfiguration rule ID for this object's expiration |
void |
setFileModeDir(boolean isFileModeDir) |
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 |
setRestoreExpirationTime(Date restoreExpirationTime)
only used to set the value in the object after receiving the value in a response from COS.
|
void |
setSecurityToken(String securityToken)
Sets the security token for the object.
|
void |
setServerSideEncryption(String serverSideEncryption)
Sets the server-side encryption algorithm for the object.
|
void |
setSSEAlgorithm(String algorithm)
Sets the server-side encryption algorithm for the response.
|
void |
setSSECustomerAlgorithm(String algorithm)
Sets the server-side encryption algorithm used when encrypting the object
with customer-provided keys.
|
void |
setSSECustomerKeyMd5(String md5Digest)
Sets the base64-encoded MD5 digest of the encryption key for server-side
encryption.
|
void |
setUserMetadata(Map<String,String> userMetadata)
Sets the custom user-metadata for the associated object.
|
setRequestId
public Map<String,String> getUserMetadata()
Gets the custom user-metadata for the associated object.
Qcloud COS can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-cos-meta-". Use user-metadata to store arbitrary metadata alongside their data in Qcloud COS. When setting user metadata, callers should not include the internal "x-cos-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-cos-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(Map<String,String> userMetadata)
Sets the custom user-metadata for the associated object.
Qcloud COS can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-cos-meta-". Use user-metadata to store arbitrary metadata alongside their data in Qcloud COS. When setting user metadata, callers should not include the internal "x-cos-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-cos-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 COS HTTP header prefix.getUserMetadata()
,
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.
Qcloud COS can store additional metadata on objects by internally representing it as HTTP headers prefixed with "x-cos-meta-". Use user-metadata to store arbitrary metadata alongside their data in Qcloud COS. When setting user metadata, callers should not include the internal "x-cos-meta-" prefix; this library will handle that for them. Likewise, when callers retrieve custom user-metadata, they will not see the "x-cos-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 COS HTTP header prefix.value
- The value for the custom user-metadata entry.setUserMetadata(Map)
,
getUserMetadata()
public Map<String,Object> getRawMetadata()
public Object getRawMetadataValue(String key)
public Date getLastModified()
null
if the Last-Modified header hasn't been set.public void setLastModified(Date lastModified)
lastModified
- The date and time at which Qcloud COS 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 COS, but the COS 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 Qcloud COS.
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 COS, but the COS 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 Qcloud COS.
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 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 COS 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(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 COS 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 COS object.getContentType()
public String getContentLanguage()
Gets the Content-Language HTTP header, which describes the natural language(s) of the intended audience for the enclosed entity.
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.
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 http://www.w3.org/ Protocols/rfc2616/rfc2616-sec14.html#sec14.11
null
if it hasn't been set.setContentType(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 http://www.w3.org/ Protocols/rfc2616/rfc2616-sec14.html#sec14.11
encoding
- The HTTP Content-Encoding header, as defined in RFC 2616.getContentType()
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 http://www.w3.org/ Protocols/rfc2616/rfc2616-sec14.html#sec14.9
null
if it
hasn't been set.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 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(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 Qcloud COS 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 Qcloud COS.
The COS Java client will attempt to calculate this field automatically when uploading files to Qcloud COS.
md5Base64
- The base64 encoded MD5 hash of the content for the object associated with
this metadata.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 Qcloud COS 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 Qcloud COS.
The COS Java client will attempt to calculate this field automatically when uploading files to Qcloud COS.
null
if the MD5 hash of the content hasn't been set.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 http://www.w3.org /Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
disposition
- The value for the Content-Disposition header.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 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 String getETag()
This field represents the hex encoded 128-bit MD5 digest of an object's content as calculated by Qcloud COS. 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 void setETag(String etagValve)
public String getVersionId()
public String getServerSideEncryption()
public void setServerSideEncryption(String serverSideEncryption)
serverSideEncryption
- The server-side encryption algorithm for the object.public void setSecurityToken(String securityToken)
securityToken
- The security token for the object.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
Rule#getId()
public void setExpirationTimeRuleId(String expirationTimeRuleId)
BucketLifecycleConfiguration
rule ID for this object's expirationsetExpirationTimeRuleId
in interface ObjectExpirationResult
expirationTimeRuleId
- The rule ID for this object's expirationpublic void setHttpExpiresDate(Date httpExpiresDate)
public Date getHttpExpiresDate()
public 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 boolean isDeleteMarker()
public void setDeleteMarker(boolean isDeleteMarker)
public boolean isFileModeDir()
public void setFileModeDir(boolean isFileModeDir)
public String getUserMetaDataOf(String key)
public ObjectMetadata clone()
public String getSSEAlgorithm()
ServerSideEncryptionResult
getSSEAlgorithm
in interface ServerSideEncryptionResult
public void setSSEAlgorithm(String algorithm)
ServerSideEncryptionResult
setSSEAlgorithm
in interface ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm for the response.public String getSSECustomerAlgorithm()
ServerSideEncryptionResult
getSSECustomerAlgorithm
in interface ServerSideEncryptionResult
public void setSSECustomerAlgorithm(String algorithm)
ServerSideEncryptionResult
setSSECustomerAlgorithm
in interface ServerSideEncryptionResult
algorithm
- The server-side encryption algorithm used when encrypting the
object with customer-provided keys.public String getSSECustomerKeyMd5()
ServerSideEncryptionResult
getSSECustomerKeyMd5
in interface ServerSideEncryptionResult
public void setSSECustomerKeyMd5(String md5Digest)
ServerSideEncryptionResult
setSSECustomerKeyMd5
in interface ServerSideEncryptionResult
md5Digest
- The base64-encoded MD5 digest of the encryption key for
server-side encryption.public String getStorageClass()
public StorageClass getStorageClassEnum()
public String getSSECOSKmsKeyId()
public String getCrc64Ecma()
public String getRequestId()
CosServiceResult
getRequestId
in class CosServiceResult
public CIUploadResult getCiUploadResult()
public void setCiUploadResult(CIUploadResult ciUploadResult)
Copyright © 2023. All rights reserved.