我正在使用JAVA创建一个VUze程序,以便在Bittorrent上实现一些实验。此代码在下载洪流时运行良好。
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();但是,我无法找到限制下载/上传带宽的方法。Vuze的文件太糟糕了..。任何帮助都将不胜感激。
谢谢。
发布于 2015-07-15 13:16:02
全局速度限制是设置。它们存储在字符串键映射中,可以在org.gudy.azureus2.core3.config.impl.ConfigurationDefaults.ConfigurationDefaults()中找到许多默认值。
由于设置都存储在单个实例中,所以可以通过静态方法(如org.gudy.azureus2.core3.config.COConfigurationManager.setParameter(String, int) )来设置设置。
注意,这些都是内部API。它们相当稳定,但不如插件API。
https://stackoverflow.com/questions/31430382
复制相似问题