public File commit() throws DigestMismatchException { if (headLength > 0) { calculateDigest(); } assert md != null; try { String contentDigest = Hex.encodeHexString(md.digest()); if (!contentDigest.equals(digest)) { file.delete(); throw new DigestMismatchException(digest, contentDigest); } } finally { IOUtils.closeWhileHandlingException(headFileChannel); headFileChannel = null; } File newFile = container.getFile(digest); file.renameTo(newFile); return newFile; }
private static File getTmpFilePath(BlobContainer blobContainer, String digest, UUID transferId) { return new File( blobContainer.getTmpDirectory(), String.format("%s.%s", digest, transferId.toString())); }
public File getContainerFile() { return container.getFile(digest); }