com.baidubce.services.bos.model
Class ObjectMetadata

java.lang.Object
  extended by com.baidubce.services.bos.model.ObjectMetadata

public class ObjectMetadata
extends Object

Represents the object metadata that is stored with Baidu Bos. This includes custom user-supplied metadata, as well as the standard HTTP headers that Baidu Bos sends and receives (Content-Length, ETag, Content-MD5, etc.).


Constructor Summary
ObjectMetadata()
           
ObjectMetadata(ObjectMetadata other)
           
 
Method Summary
 void addUserMetadata(String key, String value)
          Adds the key value pair of custom user-metadata for the associated object.
 long getAppendOffset()
           
 String getBceContentSha256()
          Gets the SHA-256 of the object content.
 String getCacheControl()
           
 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.
 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 getContentRange()
          Gets the content range of object.
 String getContentType()
          Gets the Content-Type HTTP header, which indicates the type of content stored in the associated object.
 String getETag()
          Gets the hex encoded 128-bit MD5 digest of the associated object according to RFC 1864.
 String getExpires()
           
 long getInstanceLength()
          Returns the physical length of the entire object stored in Bos.
 Date getLastModified()
          Gets the value of the Last-Modified header, indicating the date and time at which Baidu Bos last recorded a modification to the associated object.
 String getObjectType()
           
 String getStorageClass()
           
 Map<String,String> getUserMetadata()
          Gets the custom user-metadata for the associated object.
 String getUserMetaDataOf(String key)
          For internal use only.
 String getxBceCrc()
          Gets the crc of object.
 void setAppendOffset(long appendOffset)
           
 void setBceContentSha256(String bceContentSha256)
          Sets the SHA-256 of the object content.
 void setCacheControl(String cacheControl)
           
 void setContentDisposition(String contentDisposition)
          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 contentEncoding)
          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 setContentLength(long contentLength)
          Sets the Content-Length HTTP header indicating the size of the associated object in bytes.
 void setContentMd5(String contentMd5)
          Sets the base64 encoded 128-bit MD5 digest of the associated object (content - not including headers) according to RFC 1864.
 void setContentRange(String contentRange)
          Sets the content range of object.
 void setContentType(String contentType)
          Sets the Content-Type HTTP header indicating the type of content stored in the associated object.
 void setETag(String eTag)
          Sets the hex encoded 128-bit MD5 digest of the associated object according to RFC 1864.
 void setExpires(String expires)
           
 void setInstanceLength(long instanceLength)
          Sets the physical length of the entire object stored in Bos.
 void setLastModified(Date lastModified)
          For internal use only.
 void setObjectType(String objectType)
           
 void setStorageClass(String storageClass)
           
 void setUserMetadata(Map<String,String> userMetadata)
          Sets the custom user-metadata for the associated object.
 void setxBceCrc(String xBceCrc)
          Sets the crc of object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectMetadata

public ObjectMetadata()

ObjectMetadata

public ObjectMetadata(ObjectMetadata other)
Method Detail

getUserMetadata

public Map<String,String> getUserMetadata()
Gets the custom user-metadata for the associated object.

Returns:
The custom user metadata for the associated object.

setUserMetadata

public void setUserMetadata(Map<String,String> userMetadata)
Sets the custom user-metadata for the associated object.

Parameters:
userMetadata - The custom user-metadata for the associated object. Note that the key should not include the internal Bos HTTP header prefix.

addUserMetadata

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.

Parameters:
key - The key for the custom user metadata entry. Note that the key should not include the internal Bos HTTP header prefix.
value - The value for the custom user-metadata entry.

getUserMetaDataOf

public String getUserMetaDataOf(String key)
For internal use only. Returns the value of the userMetadata for the specified key.

Parameters:
key - the key of the userMetadata
Returns:
the value of the userMetadata

setContentRange

public void setContentRange(String contentRange)
Sets the content range of object.

Parameters:
contentRange - The content range of object.

getContentRange

public String getContentRange()
Gets the content range of object.

Returns:
The content range of object.

getBceContentSha256

public String getBceContentSha256()
Gets the SHA-256 of the object content.

Returns:
The SHA-256 of the object content.

setBceContentSha256

public void setBceContentSha256(String bceContentSha256)
Sets the SHA-256 of the object content.

Parameters:
bceContentSha256 - The SHA-256 of the object content.

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.

Returns:
The value of the Content-Disposition header. Returns null if the Content-Disposition header hasn't been set.

setContentDisposition

public void setContentDisposition(String contentDisposition)
Sets the optional Content-Disposition HTTP header, which specifies presentational information such as the recommended filename for the object to be saved as.

Parameters:
contentDisposition - The value for the Content-Disposition header.

getContentEncoding

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.

Returns:
The HTTP Content-Encoding header. Returns null if it hasn't been set.

setContentEncoding

public void setContentEncoding(String contentEncoding)
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.

Parameters:
contentEncoding - The HTTP Content-Encoding header, as defined in RFC 2616.

getContentLength

public long getContentLength()
Gets the Content-Length HTTP header indicating the size of the associated object in bytes.

Returns:
The Content-Length HTTP header indicating the size of the associated object in bytes. Returns null if it hasn't been set yet.

setContentLength

public void setContentLength(long contentLength)
Sets the Content-Length HTTP header indicating the size of the associated object in bytes.

Parameters:
contentLength - The Content-Length HTTP header indicating the size of the associated object in bytes.

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 Baidu Bos is the same data that the caller sent.

Returns:
The base64 encoded MD5 hash of the content for the associated object. Returns null if the MD5 hash of the content hasn't been set.

setContentMd5

public void setContentMd5(String contentMd5)
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 Baidu Bos is the same data that the caller sent. If set to null,then the MD5 digest is removed from the metadata.

Parameters:
contentMd5 - The base64 encoded MD5 hash of the content for the object associated with this metadata.

getContentType

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.

Returns:
The HTTP Content-Type header, indicating the type of content stored in the associated Bos object. Returns null if it hasn't been set.

setContentType

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.

Parameters:
contentType - The HTTP Content-Type header indicating the type of content stored in the associated Bos object.

getETag

public String getETag()
Gets the hex encoded 128-bit MD5 digest of the associated object according to RFC 1864. This data is used as an integrity check to verify that the data received by the caller is the same data that was sent by Baidu Bos.

This field represents the hex encoded 128-bit MD5 digest of an object's content as calculated by Baidu Bos. The ContentMD5 field represents the base64 encoded 128-bit MD5 digest as calculated on the caller's side.

Returns:
The hex encoded MD5 hash of the content for the associated object as calculated by Baidu Bos. Returns null if it hasn't been set yet.

setETag

public void setETag(String eTag)
Sets the hex encoded 128-bit MD5 digest of the associated object according to RFC 1864. This data is used as an integrity check to verify that the data received by the caller is the same data that was sent by Baidu Bos.

This field represents the hex encoded 128-bit MD5 digest of an object's content as calculated by Baidu Bos. The ContentMD5 field represents the base64 encoded 128-bit MD5 digest as calculated on the caller's side.

Parameters:
eTag - The hex encoded MD5 hash of the content for the associated object as calculated by Baidu Bos.

getInstanceLength

public long getInstanceLength()
Returns the physical length of the entire object stored in Bos. This is useful during, for example, a range get operation.

Returns:
the physical length of the entire object

setInstanceLength

public void setInstanceLength(long instanceLength)
Sets the physical length of the entire object stored in Bos.

Parameters:
instanceLength - the physical length of the entire object

getLastModified

public Date getLastModified()
Gets the value of the Last-Modified header, indicating the date and time at which Baidu Bos last recorded a modification to the associated object.

Returns:
The date and time at which Baidu Bos last recorded a modification to the associated object. Returns null if the Last-Modified header hasn't been set.

setLastModified

public void setLastModified(Date lastModified)
For internal use only. Sets the Last-Modified header value indicating the date and time at which Baidu Bos last recorded a modification to the associated object.

Parameters:
lastModified - The date and time at which Baidu Bos last recorded a modification to the associated object.

toString

public String toString()
Overrides:
toString in class Object

getExpires

public String getExpires()

setExpires

public void setExpires(String expires)

getAppendOffset

public long getAppendOffset()

setAppendOffset

public void setAppendOffset(long appendOffset)

getObjectType

public String getObjectType()

setObjectType

public void setObjectType(String objectType)

getCacheControl

public String getCacheControl()

setCacheControl

public void setCacheControl(String cacheControl)

getStorageClass

public String getStorageClass()

setStorageClass

public void setStorageClass(String storageClass)

getxBceCrc

public String getxBceCrc()
Gets the crc of object.

Returns:
the crc of object.

setxBceCrc

public void setxBceCrc(String xBceCrc)
Sets the crc of object.



Copyright © 2018. All rights reserved.