<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>0.1.0</version>
</dependency>
import io.minio.client.Client;
import io.minio.client.errors.ClientException;
import io.minio.client.messages.ListAllMyBucketsResult;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
public class HelloListBuckets {
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
// Set s3 endpoint, region is calculated automatically
Client s3client = Client.getClient("https://s3.amazonaws.com");
// Set access and secret keys
s3client.setKeys("YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
// list buckets
Iterator<Bucket> bucketList = s3Client.listBuckets();
while (bucketList.hasNext()) {
Bucket bucket = bucketList.next();
System.out.println(bucket.getName());
}
}
}