百度智能云

All Product Document

          Object Storage

          Acquisition of Object Meta

          Basic Introduction

          Object meta is the attribute description for the files uploaded to BOS and can be divided into two types: Meta defined by system and User Meta. Object meta can be set during the uploading through various methods or file copy.

          Metadata Defined by System Each object has a group of Metadata and Metadata is used to identify the attributes of object, e.g. date, content length. The Metadata is used for object management.

          Metadata defined by system can be divided by the modifiable for users and unmodifiable for users. The inherent attributes including creation data, content length, last modification time and MD5 are unmodifiable Metadata. Values of some Metadata including Content-Type, Cache-Control and storage-class can be modified by users as required when users create the object. The detailed description of Metadata defined by system is as follows:

          Can of
          Name Type DescriptionBe modified by
          users
          Cache-
          Control
          String Download the Cache setting of object and the common possible values are private, no-cache,
          max-age and must-revalidate.
          Yes
          Content-
          Disposition
          String Set whether the browser can download and the possible values are inline,
          attachment; "filename=download.txt".
          Yes
          Content-
          MD5
          String MD5 summary of HTTP request content defined by RFC2616 can carry the
          field to verify whether the file stored in BOS side is consistent with the file of user prediction.
          No
          Content-
          Length
          Long Int Data size returned to object. No
          Content-
          Type
          String object type and encoding. Yes
          Expires String Set cache invalidation time when downloading object. Yes
          ETag String Entity tag of HTTP protocol for object No
          x-bce-
          storage-
          class
          String Standard storage returns to STANDARD, infrequent storage returns to STANDARD_IA,
          cold storage returns to COLD and archive access returns to ARCHIVE.
          No
          x-bce-
          object-type
          String The method to identify whether the object is Appendable or common is that
          of Appendable object can be added but the common cannot. Archive access does not support Appendable.
          No

          Custom Metadata It brings convenience for users to describe more about the object. BOS specifies that all parameters with the prefix of x-bce-meta-are regarded as the custom Metadata, e.g. x-bce-meta-tag. An object can have several custom Metadata. The custom Metadata can return in HTTP header during the uploading of Getobject or Headobject.

          Note:

          • The size limitation of PUT request header is 8 KB. In PUT request header, the size limitation of custom Metadata is 2 KB.

          Operation Method

          BOS supports various kinds of SDK to acquire the meta of object. Details are as follows:

          Example

          Take Java SDK as example

          String EndPoint = "bj.bce.bos.com"
          public static void GetObjectMeta(BosClient bosClient, String bucketname, String objectkey)
              {
                  ObjectMetadata objectMetadata;
                  objectMetadata = bosClient.getObjectMetadata(bucketname, objectkey);
                  System.out.println(objectMetadata.getContentType());
                  System.out.println(objectMetadata.getUserMetadata());
              }
          Previous
          Download Data
          Next
          Delete Data