Example #1
0
  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;
  }
Example #2
0
 private static File getTmpFilePath(BlobContainer blobContainer, String digest, UUID transferId) {
   return new File(
       blobContainer.getTmpDirectory(), String.format("%s.%s", digest, transferId.toString()));
 }
Example #3
0
 public File getContainerFile() {
   return container.getFile(digest);
 }