Updated on 2024-06-21 GMT+08:00

Listing Objects

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference.

After objects are uploaded, you may want to view the objects contained in a bucket. Sample code is as follows:

ObjectListing objectListing = obsClient.listObjects("bucketname");
for(ObsObject obsObject : objectListing.getObjects()){
    Log.i("ListObjects", " - " + obsObject.getObjectKey() + "  " +  "(size = " + obsObject.getMetadata().getContentLength() + ")");
}
  • When you call ObsClient.listObjects, an instance of ObjectListing will be returned. This instance contains the response of the listObject request. You can use ObjetListing.getObjects to obtain description of all of the listed objects.
  • In the previous sample code, 1000 objects will be listed, by default.
  • For more information, see Listing Objects.