private UploadResult uploadInSinglePart(final String accountId, final String vaultName, final String archiveDescription, final File file)
throws AmazonServiceException, AmazonClientException, FileNotFoundException {
String checksum = TreeHashGenerator.calculateTreeHash(file);
RepeatableFileInputStream input = new RepeatableFileInputStream(file);
try {
UploadArchiveResult uploadArchiveResult =
glacier.uploadArchive(new UploadArchiveRequest()
.withAccountId(accountId)
.withArchiveDescription(archiveDescription)
.withVaultName(vaultName)
.withChecksum(checksum)
.withBody(input)
.withContentLength(file.length())
);
String artifactId = uploadArchiveResult.getArchiveId();
return new UploadResult(artifactId);
} finally {
try {input.close();} catch (Exception e) {}
}
}