• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Bucket Management
  5. Obtaining Storage Information About a Bucket

Obtaining Storage Information About a Bucket

The storage information about a bucket includes the used capacity of and the number of objects in the bucket. You can call ObsClient.getBucketStorageInfo to obtain the bucket storage information. 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.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);

BucketStorageInfo storageInfo = obsClient.getBucketStorageInfo("bucketname");
Log.i("GetBucketStorageInfo", "\t" + storageInfo.getObjectNumber());
Log.i("GetBucketStorageInfo", "\t" + storageInfo.getSize());

// Close obsClient.