public final class TorrentBuilder
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TorrentBuilder.Listener |
static class |
TorrentBuilder.Result |
| Modifier and Type | Field and Description |
|---|---|
static create_flags_t |
MERKLE
This will create a merkle hash tree torrent.
|
static create_flags_t |
MODIFICATION_TIME
This will include the file modification time as part of the torrent.
|
static create_flags_t |
MUTABLE_TORRENT_SUPPORT
To create a torrent that can be updated via a *mutable torrent*
(see BEP38_).
|
static create_flags_t |
OPTIMIZE_ALIGNMENT
This will insert pad files to align the files to piece boundaries, for
optimized disk-I/O.
|
static create_flags_t |
SYMLINKS
If this flag is set, files that are symlinks get a symlink attribute
set on them and their data will not be included in the torrent.
|
| Constructor and Description |
|---|
TorrentBuilder() |
| Modifier and Type | Method and Description |
|---|---|
TorrentBuilder |
addCollection(java.lang.String value)
Add collections of similar torrents.
|
TorrentBuilder |
addCollections(java.util.List<java.lang.String> value) |
TorrentBuilder |
addHttpSeed(java.lang.String value)
This adds a HTTP seed to the torrent.
|
TorrentBuilder |
addHttpSeeds(java.util.List<java.lang.String> value) |
TorrentBuilder |
addNode(Pair<java.lang.String,java.lang.Integer> value)
This adds a DHT node to the torrent.
|
TorrentBuilder |
addNodes(java.util.List<Pair<java.lang.String,java.lang.Integer>> value) |
TorrentBuilder |
addSimilarTorrent(Sha1Hash value)
Add similar torrents (by info-hash).
|
TorrentBuilder |
addSimilarTorrents(java.util.List<Sha1Hash> value) |
TorrentBuilder |
addTracker(Pair<java.lang.String,java.lang.Integer> value) |
TorrentBuilder |
addTracker(java.lang.String url) |
TorrentBuilder |
addTracker(java.lang.String url,
int tier)
Adds a tracker to the torrent.
|
TorrentBuilder |
addTrackers(java.util.List<Pair<java.lang.String,java.lang.Integer>> value) |
TorrentBuilder |
addUrlSeed(java.lang.String value)
This adds a url seed to the torrent.
|
TorrentBuilder |
addUrlSeeds(java.util.List<java.lang.String> value) |
int |
alignment() |
TorrentBuilder |
alignment(int value)
Used when pad files are enabled.
|
java.util.List<java.lang.String> |
collections() |
java.lang.String |
comment()
The comment for the torrent.
|
TorrentBuilder |
comment(java.lang.String value)
Sets the comment for the torrent.
|
java.lang.String |
creator()
The creator of the torrent.
|
TorrentBuilder |
creator(java.lang.String value)
Sets the creator of the torrent.
|
create_flags_t |
flags() |
TorrentBuilder |
flags(create_flags_t value)
Specifies options for the torrent creation.
|
TorrentBuilder.Result |
generate()
This function will generate a result withe the .torrent file as a bencode tree.
|
java.util.List<java.lang.String> |
httpSeeds() |
boolean |
isPrivate() |
TorrentBuilder.Listener |
listener() |
TorrentBuilder |
listener(TorrentBuilder.Listener value) |
java.util.List<Pair<java.lang.String,java.lang.Integer>> |
nodes() |
int |
padFileLimit() |
TorrentBuilder |
padFileLimit(int value)
If a ``pad_size_limit`` is specified (other than -1), any file larger than
the specified number of bytes will be preceded by a pad file to align it
with the start of a piece.
|
java.io.File |
path() |
TorrentBuilder |
path(java.io.File value)
Adds the file specified by
value |
int |
pieceSize() |
TorrentBuilder |
pieceSize(int value)
The size of each piece in bytes.
|
TorrentBuilder |
setPrivate(boolean value)
Sets the private flag of the torrent.
|
java.util.List<Sha1Hash> |
similarTorrents() |
java.util.List<Pair<java.lang.String,java.lang.Integer>> |
trackers() |
java.util.List<java.lang.String> |
urlSeeds() |
public static final create_flags_t OPTIMIZE_ALIGNMENT
public static final create_flags_t MERKLE
public static final create_flags_t MODIFICATION_TIME
public static final create_flags_t SYMLINKS
public static final create_flags_t MUTABLE_TORRENT_SUPPORT
BEP38: http://www.bittorrent.org/beps/bep_0038.html
public java.io.File path()
public TorrentBuilder path(java.io.File value)
valuevalue - public int pieceSize()
public TorrentBuilder pieceSize(int value)
pieceSize will be calculated such that the torrent file is roughly 40 kB.value - public int padFileLimit()
public TorrentBuilder padFileLimit(int value)
OPTIMIZE_ALIGNMENT flag is passed. Typically it doesn't make sense
to set this any lower than 4kiB.value - public create_flags_t flags()
public TorrentBuilder flags(create_flags_t value)
create_flags_tvalue - public int alignment()
public TorrentBuilder alignment(int value)
value - public java.lang.String comment()
public TorrentBuilder comment(java.lang.String value)
value - public java.lang.String creator()
public TorrentBuilder creator(java.lang.String value)
value - public java.util.List<java.lang.String> urlSeeds()
public TorrentBuilder addUrlSeeds(java.util.List<java.lang.String> value)
value - public TorrentBuilder addUrlSeed(java.lang.String value)
value - public java.util.List<java.lang.String> httpSeeds()
public TorrentBuilder addHttpSeeds(java.util.List<java.lang.String> value)
value - public TorrentBuilder addHttpSeed(java.lang.String value)
value - public java.util.List<Pair<java.lang.String,java.lang.Integer>> nodes()
public TorrentBuilder addNodes(java.util.List<Pair<java.lang.String,java.lang.Integer>> value)
value - public TorrentBuilder addNode(Pair<java.lang.String,java.lang.Integer> value)
value - public java.util.List<Pair<java.lang.String,java.lang.Integer>> trackers()
public TorrentBuilder addTrackers(java.util.List<Pair<java.lang.String,java.lang.Integer>> value)
value - public TorrentBuilder addTracker(Pair<java.lang.String,java.lang.Integer> value)
value - public TorrentBuilder addTracker(java.lang.String url, int tier)
url - tier - public TorrentBuilder addTracker(java.lang.String url)
url - public boolean isPrivate()
public TorrentBuilder setPrivate(boolean value)
Torrents with the private flag set ask clients to not use any other sources than the tracker for peers, and to not advertise itself publicly, apart from the tracker.
value - public java.util.List<Sha1Hash> similarTorrents()
public TorrentBuilder addSimilarTorrents(java.util.List<Sha1Hash> value)
value - public TorrentBuilder addSimilarTorrent(Sha1Hash value)
Similar torrents are expected to share some files with this torrent. Torrents sharing a collection name with this torrent are also expected to share files with this torrent. A torrent may have more than one collection and more than one similar torrents. For more information, see BEP 38.
BEP 38: http://www.bittorrent.org/beps/bep_0038.html
value - public java.util.List<java.lang.String> collections()
public TorrentBuilder addCollections(java.util.List<java.lang.String> value)
value - public TorrentBuilder addCollection(java.lang.String value)
Similar torrents are expected to share some files with this torrent. Torrents sharing a collection name with this torrent are also expected to share files with this torrent. A torrent may have more than one collection and more than one similar torrents. For more information, see BEP 38.
BEP 38: http://www.bittorrent.org/beps/bep_0038.html
value - public TorrentBuilder.Listener listener()
public TorrentBuilder listener(TorrentBuilder.Listener value)
value - public TorrentBuilder.Result generate() throws java.io.IOException
java.io.IOException