예제 #1
0
 /**
  * Updates the files in the specified collection to start at the new base path. The files must
  * already be absolute and be children of _completeFile.
  *
  * @param completeBase the new base path
  */
 private void updateReferences(File completeBase, List<TorrentFile> l) {
   int offset = _completeFile.getAbsolutePath().length();
   String newPath = completeBase.getAbsolutePath();
   for (int i = 0; i < l.size(); i++) {
     TorrentFile current = l.get(i);
     TorrentFile updated =
         new TorrentFile(
             current.length(),
             newPath + current.getPath().substring(offset),
             current.getTorrentPath());
     updated.setBeginPiece(current.getBeginPiece());
     updated.setEndPiece(current.getEndPiece());
     updated.setStartByte(current.getStartByte());
     updated.setEndByte(current.getEndByte());
     l.set(i, updated);
   }
 }