使用 vuze 限制带宽 API

limiting bandwidth with vuze API

我正在使用 VUze API 创建一个 JAVA 程序,以便在 Bittorrent 上进行一些实验。 此代码在下载 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();

但是,我找不到限制download/upload带宽的方法。 Vuze 的文档太糟糕了...... 任何帮助将不胜感激。

谢谢。

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

中找到许多默认值

由于设置都存储在一个单例中,因此可以通过 org.gudy.azureus2.core3.config.COConfigurationManager.setParameter(String, int)

等静态方法进行设置

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