📜  如何在 java 代码示例中使用 Admin Sdk 将图像发送到存储

📅  最后修改于: 2022-03-11 14:52:19.110000             🧑  作者: Mango

代码示例1
String file_path = file.getPath();
InputStream file_input_stream = new FileInputStream(file_path);

BlobId blobId = BlobId.of(bucket, folder+"/"+blobName);
System.out.println("Blob Id:"+blobId);
BlobInfo blobInfo = BlobInfo
            .newBuilder(blobId)
            .setContentType("application/pdf")              
            .build();
Blob blob = storage.create(blobInfo, file_input_stream.readAllBytes());