Adding downloads from URLs

From VuzeWiki
Jump to: navigation, search

If you need to add a download into Azureus by grabbing the torrent from a URL, *and* you want to have a reference to the resulting download, here's a way to do it:

ResourceDownloader rdl = pluginInterface.getUtilities().getResourceDownloaderFactory().create(url);
InputStream is = rdl.download();
Torrent t = torrentManager.createFromBEncodedInputStream(is);
Download d = pluginInterface.getDownloadManager().addDownload(t);