2014-03-02 2 views
1

내 프로그램에 tTorrent 클라이언트를 구현하려고하는데이 링크 (예 : https://github.com/mpetazzoni/ttorrent/issues/16)를보고 해당 코드를 내 프로그램의 다운로드 클래스에 넣었습니다.t 토런트 클라이언트 오류

import 문 :

import main.java.com.turn.ttorrent.client.Client; 
import main.java.com.turn.ttorrent.client.SharedTorrent; 
import main.java.com.turn.ttorrent.common.Torrent; 
import main.java.com.turn.ttorrent.tracker.TrackedTorrent; 
import main.java.com.turn.ttorrent.tracker.Tracker; 



// Create tracker instance 
    Tracker tracker = new Tracker(InetAddress.getLocalHost()); 
    // Load torrent file 
    File torrentFile = new File("/path/to/torrentFile.torrent"); 
    // Create torrent instance 
    TrackedTorrent torrent = new TrackedTorrent(Torrent.load(torrentFile, null)); 
    // Announce torrent 
    tracker.announce(torrent); 
    // Start the tracker 
    tracker.start(); 

    torrentFile = new File(path + ".torrent"); 
    File downloadDir = new File("/path/to/torrents_download_dir");//unsure 

    Client client = new Client(InetAddress.getLocalHost(), SharedTorrent.fromFile(torrentFile, downloadDir)); 
    // Add client.share(); if you wish to share the torrent infinitely 
    client.run(); 

내가 부하 위에 마우스를 올려 때이 오류 메시지가 받고 있어요 :

The method load(File, boolean) in the type Torrent is not applicable for the arguments (File, null) 

나는 또한 내가 File downloadDir에 배치해야하는지 확실 해요 여기에 코드입니다 . 나는 아직 초보자이며 누군가가 내 프로그램에 이것을 넣으면 올바른 방향으로 나를 가리킬 수 있다면 좋을 것입니다. 나는 아직 초보자입니다.

+0

오류 메시지를 해석하는 학습 주요 방법

public static void main(String[] args) { // Object 1; // Object 2; 

}에서 객체와 메서드를 작성합니다. 괜찮아. Load는 boolean을 기대하며 null을 제공합니다. – Brendan

+0

오류 메시지를 해석하는 방법을 알고 있습니다. 질문을 게시하기 전에 나는 그것을 false로 설정하려했지만 "TrackedTorrent (토렌트) 생성자가 정의되지 않았습니다"라는 오류 메시지를 보냈습니다. 또한, tTorrent가 제공 한 gitHub 링크에 제공된 예제는 null로 설정되어 있습니다. 우리가 어디에도 가지 않았기 때문에 당신과 같은 대답을 게시하고 그것을 삭제 한 또 다른 사람이있었습니다. – Joe

답변

0

Torrent.load (torrentFile, null)는 File 객체를 원합니다.

예컨대

Torrent.load(new File(/foo/path.torrent), null) 
관련 문제