Пример #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;
  }
Пример #2
0
 public File getContainerFile() {
   return container.getFile(digest);
 }