public static TOTorrent readFromFile( File file, boolean create_delegate ) throws TOTorrentException { return( readFromFile( file, create_delegate, false )); }
/** * If you set "create_delegate" to true then you must understand that this results * is piece hashes being discarded and then re-read from the torrent file if needed * Therefore, if you delete the original torrent file you're going to get errors * if you access the pieces after this (and they've been discarded) * @param file * @param create_delegate * @param force_initial_discard - use to get rid of pieces immediately * @return * @throws TOTorrentException */ public static ExtendedTorrent readDelegateFromFile( File file, boolean force_initial_discard ) throws TOTorrentException { return((ExtendedTorrent)readFromFile( file, true, force_initial_discard )); }
@Override public Torrent createFromBEncodedFile( File file, boolean for_seeding ) throws TorrentException { try{ TOTorrent torrent; if ( for_seeding ){ torrent = TorrentUtils.readFromFile( file, true, true ); }else{ torrent = TorrentUtils.readFromFile( file, false ); } return( new TorrentImpl(plugin_interface,torrent)); }catch( TOTorrentException e ){ throw( new TorrentException( "TorrentManager::createFromBEncodedFile Fails", e )); } }
public static void setObtainedFrom( File file, String str ) { try{ TOTorrent torrent = readFromFile( file, false, false ); setObtainedFrom( torrent, str ); writeToFile( torrent ); } catch (TOTorrentException e) { // ignore, file probably not torrent }catch( Throwable e ){ Debug.out( e ); } }
File file = new File( new String( file_b, Constants.BYTE_ENCODING )); torrent = TorrentUtils.readFromFile( file, true, true );
TOTorrent temp = readFromFile( file, false );
FileUtil.writeBytesAsFile(filename, decodedTorrent); TOTorrent torrent = TorrentUtils.readFromFile(tempTorrentFile, false);
if ( !filename.toLowerCase().endsWith(".torrent" )){ TOTorrent torrent = TorrentUtils.readFromFile( file, false );
public class Checker extends AEThread { int loopFactor; private static final int waitTime = 10*1000; // 5 minutes save resume data interval (default) private int saveResumeLoopCount = 5*60*1000 / waitTime; private static final int initSaveResumeLoopCount = 60*1000 / waitTime; private static final int natCheckLoopCount = 30*1000 / waitTime; private static final int seedPieceCheckCount = 30*1000 / waitTime; private static final int oneMinuteThingCount = 60*1000 / waitTime; private final AESemaphore run_sem = new AESemaphore( "GM:Checker:run"); public Checker() { super("Global Status Checker"); loopFactor = 0; setPriority(Thread.MIN_PRIORITY); //determineSaveResumeDataInterval(); } private void determineSaveResumeDataInterval() { int saveResumeInterval = COConfigurationManager.getIntParameter("Save Resume Interval", 5); if (saveResumeInterval >= 1 && saveResumeInterval <= 90) saveResumeLoopCount = saveResumeInterval * 60000 / waitTime; } @Override public void runSupport() { while ( true ){
TOTorrent original_torrent = TorrentUtils.readFromFile( new File(torrent_file), true );
TOTorrent torrent = TorrentUtils.readFromFile(file, false);
torrent = TorrentUtils.readFromFile(torrentFile, false); } catch (final TOTorrentException e) {