public long getFileSize() { return _info.getFileSystem().getTotalSize(); }
public int getIndex() { // negative will make sure it never conflicts with regular uploads return 0 - Math.abs(_info.getURN().hashCode()); }
public String getCustomIconDescriptor() { if (_info.getFileSystem().getFiles().size() == 1) return null; return BITTORRENT_UPLOAD; }
public String getFileName() { return _info.getName(); }
/** * Get the path to where the program will save this BitTorrent download when it's done. * * @param The path in a Java File object, like "C:\Documents and Settings\Kevin\Shared\File * Name.ext" */ public File getSaveFile() { // Get the path from the BTMetaInfo object return _info.getCompleteFile(); }
/** * Find out how many bytes of torrent data we've received, but are waiting for a thread to write * to disk. * * @return The number of bytes */ public int getAmountPending() { // Ask our torrent's VerifyingFolder object return _info.getVerifyingFolder().getAmountPending(); }
/** * Get the size of file pieces we're downloading. * * @return The size of each file piece */ public int getChunkSize() { // Return the number we parsed from the .torrent file return (int) _info.getPieceLength(); }
/** * Get the number of bytes we downloaded but then discarded because they didn't hash correctly. * * @return The size in bytes */ public long getAmountLost() { // Ask the VerifyingFolder object return _info.getVerifyingFolder().getNumCorruptedBytes(); }
/** * Find out how much of this file we've verified as valid. * * @return The size of verified data, in bytes */ public long getAmountVerified() { // Ask the VerifyingFolder object how many verified blocks we have, and multiply that by the // block size to get bytes return _info.getVerifyingFolder().getVerifiedBlockSize(); }
/** * Get the size of the portion of the file we've downloaded. If we download the same part of the * file twice, this number counts it just once. * * @return The size of data in bytes */ public long getAmountRead() { // Ask the VerifyingFolder object return _info.getVerifyingFolder().getBlockSize(); }
/** * Get the file size of this torrent. If this is a multifile torrent, returns the total size of * all the files placed together. * * @return The size in bytes */ public long getContentLength() { // Get this information from the bencoded data in the .torrent file return _info.getTotalSize(); }
/** * Get the file name of this torrent. If this is a multifile torrent, returns the folder name. * * @return The file or folder name as a String */ public String getFileName() { // Ask the BTMetaInfo object, get the name from the bencoded data in the .torrent file return _info.getName(); }
/** * Get the path of this BitTorrent download. While we're still getting the torrent, returns a path * like "C:\Documents and Settings\Kevin\Incomplete\File Name.ext". After it's done, returns a * path like "C:\Documents and Settings\Kevin\Shared\File Name.ext". * * @return A Java File object with the path */ public File getFile() { // Return the path in the "Saved" or "Incomplete" folder if (_torrent.isComplete()) return _info.getCompleteFile(); return _info.getBaseFile(); }