Example #1
0
  public Download(
      DownloadManager parent,
      Hash root,
      BlockStorage storage,
      String filename,
      ArrayList<Integer> guids)
      throws IOException {
    this.manager = parent;
    this.root = root;
    this.storage = storage;
    this.auxInfoFilename = filename;
    this.auxInfoGuids = guids;

    setFd(
        manager
            .getCore()
            .getFileManager()
            .getFd(root)); // not sure there is one, but when resuming there is

    if (fd != null) {
      BlockFile bf = storage.getBlockFile(fd.getRootHash());
      if (bf != null) {
        bytesComplete = ((long) bf.getNumberOfBlocksComplete()) * BLOCK_SIZE;
      }
    }
  }