• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Object Download
  5. Obtaining Customized Metadata

Obtaining Customized Metadata

After an object is successfully downloaded, its customized data is returned. Sample code is as follows:

String endPoint = "yourdomainname";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";

// Create an instance of ObsClient.
final ObsClient obsClient = new ObsClient(ak, sk, endPoint);

// Upload the object and customize the metadata.
PutObjectRequest request = new PutObjectRequest("bucketname", "objectkey");
ObjectMetadata metadata = new ObjectMetadata();
metadata.addUserMetadata("property", "property-value");

// Download the object and obtain the customized metadata.
ObsObject obsObject = obsClient.getObject("bucketname", "objectkey");
Log.i("GetObject", obsObject.getMetadata().getUserMetadata("property"));


// Close obsClient.