0
從documentation on gsutil:Google的'gsutil cp'命令對傳輸的文件運行校驗和。 Google的Java存儲API是否也一樣?
「每上傳年底或下載gsutil cp指令驗證了它計算源文件的校驗/對象的服務計算校驗和匹配。如果校驗和不匹配,gsutil會將刪除損壞的對象並打印警告消息。「
而且這裏的一些sample code使用他們的Java存儲API:
public static void uploadFile(String name, String contentType, File file, String bucketName)
throws IOException, GeneralSecurityException {
InputStreamContent contentStream = new InputStreamContent(
contentType, new FileInputStream(file));
// Setting the length improves upload performance
contentStream.setLength(file.length());
StorageObject objectMetadata = new StorageObject()
// Set the destination object name
.setName(name)
// Set the access control list to publicly read-only
.setAcl(Arrays.asList(
new ObjectAccessControl().setEntity("allUsers").setRole("READER")));
// Do the insert
Storage client = StorageFactory.getService();
Storage.Objects.Insert insertRequest = client.objects().insert(
bucketName, objectMetadata, contentStream);
insertRequest.execute();
}
是進行必要的校驗?我應該手動做嗎?