예제 #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);
 }