minio是一个开源的高性能分布式存储系统。
官网文档中的java示例:
FileUploader.java
import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; import org.xmlpull.v1.XmlPullParserException; import io.minio.MinioClient; import io.minio.errors.MinioException; public class FileUploader { public static void main(String[] args) throws NoSuchAlgorithmException, IOException, InvalidKeyException, XmlPullParserException { try { // Create a minioClient with the Minio Server name, Port, Access key and Secret key. MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); // Check if the bucket already exists. boolean isExist = minioClient.bucketExists("asiatrip"); if(isExist) { System.out.println("Bucket already exists."); } else { // Make a new bucket called asiatrip to hold a zip file of photos. minioClient.makeBucket("asiatrip"); } // Upload the zip file to the bucket with putObject minioClient.putObject("asiatrip","asiaphotos.zip", "/home/user/Photos/asiaphotos.zip"); System.out.println("/home/user/Photos/asiaphotos.zip is successfully uploaded as asiaphotos.zip to `asiatrip` bucket."); } catch(MinioException e) { System.out.println("Error occurred: " + e); } } }
参考:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END