Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java tTorrent库:如何安装和使用这些库?_Java_Netbeans_Download_Torrent - Fatal编程技术网

Java tTorrent库:如何安装和使用这些库?

Java tTorrent库:如何安装和使用这些库?,java,netbeans,download,torrent,Java,Netbeans,Download,Torrent,基本上,我正在制作一个程序,可以通过使用许多API从电影中获取所有信息。它还从电影中下载.torrent文件。我想在我的程序中下载这个,并想使用它。唯一的问题是:我必须如何使用它?在阅读所有的安装或自述文件,它没有说什么给我。我知道如何安装一个普通的库,但它在多个映射中有多个文件等 所以,第一个问题:你能简单地解释一下我是如何一步一步安装这个库的吗 第二个问题:你能告诉我如何使用它下载.torrent文件吗 顺便说一句:如果有任何方法可以使用qBittorrent自动打开.torrent文件,那

基本上,我正在制作一个程序,可以通过使用许多API从电影中获取所有信息。它还从电影中下载.torrent文件。我想在我的程序中下载这个,并想使用它。唯一的问题是:我必须如何使用它?在阅读所有的安装或自述文件,它没有说什么给我。我知道如何安装一个普通的库,但它在多个映射中有多个文件等

所以,第一个问题:你能简单地解释一下我是如何一步一步安装这个库的吗

第二个问题:你能告诉我如何使用它下载.torrent文件吗

顺便说一句:如果有任何方法可以使用qBittorrent自动打开.torrent文件,那么这将是我唯一可以接受的选择。

1)安装maven,查看如何使用maven快速启动“Hello World”项目。抓住它后,添加

<dependency>
  <groupId>com.turn</groupId>
  <artifactId>ttorrent</artifactId>
  <version>1.4</version>
</dependency>

在stack中,你的想法是做一些努力,然后告诉每个人你做了什么,你是如何通过代码做的,并给出错误信息,而不是简单地请求他人帮助
// First, instantiate the Client object.
Client client = new Client(
  // This is the interface the client will listen on (you might need something
  // else than localhost here).
  InetAddress.getLocalHost(),

  // Load the torrent from the torrent file and use the given
  // output directory. Partials downloads are automatically recovered.
  SharedTorrent.fromFile(
    new File("/path/to/your.torrent"),
    new File("/path/to/output/directory")));

// You can optionally set download/upload rate limits
// in kB/second. Setting a limit to 0.0 disables rate
// limits.
client.setMaxDownloadRate(50.0);
client.setMaxUploadRate(50.0);

// At this point, can you either call download() to download the torrent and
// stop immediately after...
client.download();

// Or call client.share(...) with a seed time in seconds:
// client.share(3600);
// Which would seed the torrent for an hour after the download is complete.

// Downloading and seeding is done in background threads.
// To wait for this process to finish, call:
client.waitForCompletion();

// At any time you can call client.stop() to interrupt the download.