/** Initializes entries with URNs, Files & Ranges. */
  public synchronized void initEntry(
      File incompleteFile, List<Range> ranges, URN sha1, boolean publish)
      throws InvalidDataException {
    try {
      incompleteFile = canonicalize(incompleteFile);
    } catch (IOException iox) {
      throw new InvalidDataException(iox);
    }

    VerifyingFile verifyingFile;
    try {
      verifyingFile = verifyingFileFactory.createVerifyingFile(getCompletedSize(incompleteFile));
    } catch (IllegalArgumentException iae) {
      throw new InvalidDataException(iae);
    }
    if (ranges != null) {
      for (Range range : ranges) {
        verifyingFile.addInterval(range);
      }
    }
    if (ranges == null || ranges.isEmpty()) {
      try {
        verifyingFile.setScanForExistingBlocks(true, incompleteFile.length());
      } catch (IOException iox) {
        throw new InvalidDataException(iox);
      }
    }
    blocks.put(incompleteFile, verifyingFile);
    if (sha1 != null) hashes.put(sha1, incompleteFile);
    if (publish) registerIncompleteFile(incompleteFile);
  }
 public synchronized long getBlockSize(File incompleteFile) {
   VerifyingFile vf = blocks.get(incompleteFile);
   if (vf == null) return 0;
   else return vf.getBlockSize();
 }