• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Object Management
  5. Obtaining Object Attributes

Obtaining Object Properties

You can call ObsClient.getObjectMetadata to obtain properties of an object, including the length, MIME type, customized metadata. 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);

ObjectMetadata metadata = obsClient.getObjectMetadata("bucketname", "objectkey");
Log.i("GetObjectMetadata","\t" + metadata.getContentType());
Log.i("GetObjectMetadata","\t" + metadata.getContentLength());
Log.i("GetObjectMetadata","\t" + metadata.getUserMetadata("property"));


// Close obsClient.
obsClient.close();