|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectjBittorrentAPI.TorrentProcessor
public class TorrentProcessor
Class enabling to process a torrent file
| Field Summary | |
|---|---|
private TorrentFile |
torrent
|
| Constructor Summary | |
|---|---|
TorrentProcessor()
|
|
TorrentProcessor(TorrentFile torrent)
|
|
| Method Summary | |
|---|---|
int |
addFile(java.io.File file)
Add the files in the list to the torrent |
int |
addFile(java.lang.String filename)
Add the files in the list to the torrent |
int |
addFiles(java.util.List l)
Add the files in the list to the torrent |
int |
addFiles(java.lang.Object[] filenames)
Add the files in the list to the torrent |
void |
generatePieceHashes()
Generate the SHA-1 hashes for the files in the current object TorrentFile |
void |
generatePieceHashes(TorrentFile torr)
Generate the SHA-1 hashes for the file in the torrent in parameter |
byte[] |
generateTorrent()
Generate the bytes for the current object TorrentFile |
byte[] |
generateTorrent(TorrentFile torr)
Generate the bytes of the bencoded TorrentFile data |
TorrentFile |
getTorrent()
Returns the local TorrentFile in its current state |
TorrentFile |
getTorrentFile(java.util.Map m)
Given a Map, retrieve all useful information and represent it as a TorrentFile object |
java.util.Map |
parseTorrent(java.io.File file)
Given a File (supposed to be a torrent), parse it and represent it as a Map |
java.util.Map |
parseTorrent(java.lang.String filename)
Given the path of a torrent, parse the file and represent it as a Map |
void |
setAnnounceURL(java.lang.String url)
Sets the announce url of the torrent |
void |
setComment(java.lang.String comment)
Sets the comment about this torrent |
void |
setCreationDate(long date)
Sets the time the torrent was created |
void |
setCreator(java.lang.String creator)
Sets the creator of the torrent. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding of the torrent |
void |
setName(java.lang.String name)
Sets the directory the files have to be saved in (in case of multiple files torrent) |
void |
setPieceLength(int length)
Sets the pieceLength |
void |
setTorrent(TorrentFile torr)
Sets the TorrentFile object of the Publisher equals to the given one |
void |
setTorrentData(java.lang.String url,
int pLength,
java.lang.String comment,
java.lang.String encoding,
java.lang.String filename)
Updates the TorrentFile object according to the given parameters |
void |
setTorrentData(java.lang.String url,
int pLength,
java.lang.String comment,
java.lang.String encoding,
java.lang.String name,
java.util.List filenames)
Updates the TorrentFile object according to the given parameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private TorrentFile torrent
| Constructor Detail |
|---|
public TorrentProcessor()
public TorrentProcessor(TorrentFile torrent)
| Method Detail |
|---|
public int addFile(java.io.File file)
file - The file to be added
java.lang.Exceptionpublic int addFile(java.lang.String filename)
filename - The path of the file to be added
java.lang.Exception
public int addFiles(java.util.List l)
throws java.lang.Exception
l - A list containing the File or String object representing the files to be added
java.lang.Exceptionpublic int addFiles(java.lang.Object[] filenames)
filenames - An array containing the files to be added
java.lang.Exceptionpublic void generatePieceHashes()
public void generatePieceHashes(TorrentFile torr)
torr - TorrentFilepublic byte[] generateTorrent()
public byte[] generateTorrent(TorrentFile torr)
torr - TorrentFile
public TorrentFile getTorrent()
public TorrentFile getTorrentFile(java.util.Map m)
m - Map
public java.util.Map parseTorrent(java.io.File file)
file - File
public java.util.Map parseTorrent(java.lang.String filename)
filename - String
public void setAnnounceURL(java.lang.String url)
url - Stringpublic void setComment(java.lang.String comment)
comment - Stringpublic void setCreationDate(long date)
date - longpublic void setCreator(java.lang.String creator)
creator - Stringpublic void setEncoding(java.lang.String encoding)
encoding - Stringpublic void setName(java.lang.String name)
name - Stringpublic void setPieceLength(int length)
length - intpublic void setTorrent(TorrentFile torr)
torr - TorrentFile
public void setTorrentData(java.lang.String url,
int pLength,
java.lang.String comment,
java.lang.String encoding,
java.lang.String filename)
url - The announce urlpLength - The length of the pieces of the torrentcomment - The comments for the torrentencoding - The encoding of the torrentfilename - The path of the file to be added to the torrent
public void setTorrentData(java.lang.String url,
int pLength,
java.lang.String comment,
java.lang.String encoding,
java.lang.String name,
java.util.List filenames)
throws java.lang.Exception
url - The announce urlpLength - The length of the pieces of the torrentcomment - The comments for the torrentencoding - The encoding of the torrentname - The name of the directory to save the files infilenames - The path of the file to be added to the torrent
java.lang.Exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||