获取桶列表

Bucket是用于存储对象(Object)的容器,所有的对象都必须隶属于某个Bucket。本文介绍如何获取桶(Bucket)列表。

接口定义:

public List<Bucket> listBuckets()

代码示例:

    public void ListBuckets(OnS3ResponseListener<List<Bucket>> listener){
        GlobalThreadPool.getInstance().execute(() -> {
            try {
                List<Bucket> list = sS3Client.listBuckets();

                Handler mainHandler = new Handler(Looper.getMainLooper());
                mainHandler.post(() -> listener.onResponse(list));
            } catch (Exception e) {
                Handler mainHandler = new Handler(Looper.getMainLooper());
                mainHandler.post(() -> listener.onError());
            }
        });
    }