1

I'm using VUze API to create a JAVA program in order to implement a few experiments on Bittorrent. This code works fine when downloading a torrent

String url = "500mega.torrent";
    core = AzureusCoreFactory.create();
    core.start();
    // System.out.println("Attempting to download torrent at : " + url);

    File downloadedTorrentFile = new File(url);

    System.out.println("Completed download of : " + url);
    System.out.println("File stored as : "
            + downloadedTorrentFile.getAbsolutePath());

    File downloadDirectory = new File("downloads"); // Destination directory
    if (downloadDirectory.exists() == false)
        downloadDirectory.mkdir();
    COConfigurationManager.initialise();
    GlobalManager globalManager = core.getGlobalManager();
    DownloadManager manager = globalManager.addDownloadManager(
            downloadedTorrentFile.getAbsolutePath(),
            downloadDirectory.getAbsolutePath());
    DownloadManagerListener listener = new DownloadStateListener();
    manager.addListener(listener);

    TransferSpeedValidator.setGlobalDownloadRateLimitBytesPerSecond(100);
    System.out.println(TransferSpeedValidator
            .getGlobalDownloadRateLimitBytesPerSecond());
    globalManager.startAllDownloads();

However, I can't find the method to limit the download/upload bandwidth. The documentation for Vuze is so bad... Any help would be greatly appreciated.

Thanks.

4

1 回答 1

1

全局速度限制是设置。它们存储在字符串键控映射中,您可以在org.gudy.azureus2.core3.config.impl.ConfigurationDefaults.ConfigurationDefaults().

由于设置都存储在单例中,因此可以通过静态方法进行设置,例如org.gudy.azureus2.core3.config.COConfigurationManager.setParameter(String, int)

请注意,这些是内部 API。它们相当稳定,但不如插件 API

于 2015-07-15T13:16:02.777 回答