1 Star 0 Fork 0

ffggll/TorrentEngine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.rst 10.40 KB
一键复制 编辑 原始数据 按行查看 历史
Joseph Paul Cohen 提交于 2016-05-24 05:33 +08:00 . Update index.rst

Torrents Engine

Introduction

TorrentEngine is a Full Featured Pure Java Bit-Torrent Library based on Gudy, Azureus, FrostWire, LimeWire, and Vuze. It provides all major features of BitTorrent libraries including magnet links, DHT, Web-Seeds, IPv6, UPnP, Peer Exchange, Encryption, and UDP Trackers.

The base code has been evolving over the years between builds of Gudy, Azureus, FrostWire, LimeWire, and Vuze. Because of this the code had become so complicated and redundant that it was hard to be taken seriously in industry. We refactored almost all major components and removed unused code. The resulting library is designed to be easy to understand and work with.

Contributors:

Greg McPherran

Alpesh Kothari

Advisors:

Joseph Paul Cohen PhD

Henry Z. Lo PhD

Using the Software

The software is developed in Java and is available at https://github.com/wiperz1789/Torrent-Engine/tree/master

The software can be used by any Java application and the available features of the software are provided below.

The TorrentEngineCore "API" class provides the following methods:

void start()

Description: Starts the main core of the engine

Examples:

TorrentEngineCore core= AzureusCoreFactory.create();
core.start();

void stop()

Description: If requestStop() fails to stop the core then, force stop is called.

Examples:

TorrentEngineCore core= AzureusCoreFactory.create();
  core.stop();

boolean canStart()

Description: Checks whether core can be started or not.

static boolean isCoreAvailable()

Description: Returns true if core is available, false otherwise.

static boolean isCoreRunning()

Description: Returns true if core is running, false otherwise.

boolean isInitThread()

Description: Returns true if thread is initialized already, else false.

void requestStop()

Description: Normal core stop request.

The GlobalManager "API" class provides the following methods:

DownloadManager addDownloadManager(String fileName, String savePath)

Description: Add torrent file to download manager.
Parameters: A filename and path where it needs to be saved.

Examples:

GlobalManager globalManager = core.getGlobalManager();
globalManager.addDownloadManager(filename,pathToSave);

void addListener(GlobalManagerListener listener)

Description: Add listener to download manager, which initiates the download process.
Parameters: GlobalManagerListener.

Examples:

DownloadManagerListener listener = new DownloadStateListener();
    manager.addListener(listener);

boolean canPauseDownloads()

Description: Returns true if download can be paused, false otherwise.

boolean canResumeDownloads()

Description: Returns true if download can be resumed, false otherwise.

void pauseDownloadsForPeriod(int seconds)

Description: Pause download for specific period of time.
Parameters: int.

void removeDownloadManager(DownloadManager manager)

Description: Remove download manager.
Parameters: DownloadManager.

DownloadManager getDownloadManager(TOTorrent torrent)

Description: Get download manager for particular torrent.
Parameters: TOTorrent.

void resumeDownloads()

Description: To resume downloads for current download manager.

void saveState()

Description: Save current state of download manager, which can be resumed later.

void startAllDownloads()

Description: Starts download from all download manager

Examples:

globalManager.startAllDownloads();

void stopAllDownloads()

Description: Stops download process from all download manager

Examples:

globalManager.stopAllDownloads();

void stopGlobalManager()

Description: Stops global manager.

The DownloadManager "API" class provides the following methods:

void addDiskListener(DownloadManagerDiskListener listener)

Description: DiskListener monitors the disk operations.
Parameters: DownloadManagerDiskListener.

void addListener(DownloadManagerListener listener)

Description: Add listener to specific download manager, which initiates the download process.
Parameters: DownloadManagerListener.

void addPeer(PEPeer peer)

Description: Adds peers to current DownloadManager.
Parameters: PEPeer.

void addPeerListener(DownloadManagerPeerListener listener)

Description: Add listener to peers to current DownloadManager.

File getSaveLocation()

Description: Returns the location where file is saved.

void saveResumeData()

Description: Save the data after resume is initiated.
Parameters: TOTorrent.

void startDownload()

Description: Starts the download for loaded download manager.

The DiskManager "API" class provides the following methods:

DiskManagerFileInfo[] getFiles()

Description: Returns array all the files described in torrent meta-data.

DiskManagerFileInfoSet getFileSet()

Description: Returns set all the files in torrents meta-data.

long getSizeExcludingDND()

Description: Returns the overall size of files, excluding the size of the files which won't be downloaded.

void start()

Description: Turns on the downloading process.

boolean stop(boolean closing)

Description: Stops downloading of files.
Parameters: boolean.

boolean filesExist()

Description: Returns true if file exists, otherwise false

The TorrentEngine "API" class provides the following methods (static):

void download(String item)

Description: Download the specified torrent or torrent collection.
Parameters:
item: A file, url, or hash of a torrent or the name of a torrent collection.

Examples:

download("551952d08103200cf5034fb74adf71643aa0c643");
download("http://umb.edu/Astronomy_Journal_2015.torrent");

void downloadFiles(String item, String[ ] fileNumbers)

Description: Download the specified files of the torrent or torrent collection.
Parameters:
item: A file, url, or hash of a torrent or the name of a torrent collection.
fileNumbers: A string array of the numbers (1-based) of the files to download.

Example:

download("Crater_Analysis_2015.torrent", new String[] {"5", "12", "27"});

void list(String item)

Description: List the files of a torrent or the torrents of a collection.
Parameter:
item: A file, url, or hash of a torrent or the name of a torrent collection.

Example:

list("noaa datasets");
list("551952d08103200cf5034fb74adf71643aa0c643");
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/llggff/TorrentEngine.git
[email protected]:llggff/TorrentEngine.git
llggff
TorrentEngine
TorrentEngine
master

搜索帮助