Constructor and Description |
---|
TorrentBuilder() |
Modifier and Type | Method and Description |
---|---|
TorrentBuilder |
addAnnounceGroup(Collection<String> announceGroup) |
TorrentBuilder |
addFile(Path file)
Add a file to be included within the torrent
|
TorrentBuilder |
addFiles(Path... files) |
TorrentBuilder |
announce(String announce) |
byte[] |
build()
Build the torrent
|
TorrentBuilder |
createdBy(String createdBy)
Set the author of the torrent stored in the created by flag.
|
TorrentBuilder |
creationDate(Date creationDate)
Set the creation date of the torrent.
|
String |
getAnnounce() |
List<List<String>> |
getAnnounceGroups() |
String |
getCreatedBy() |
long |
getCreationDate()
|
List<Path> |
getFiles() |
int |
getHashingBufferSize()
Get the digest buffer size
|
int |
getMaxNumOpenFiles()
|
int |
getNumHashingThreads() |
int |
getPieceSize() |
Path |
getRootPath() |
TorrentBuilder |
hashingBufferSize(int hashingBufferSize)
Set the size of the io buffer used for reading from files to verify their digest.
|
boolean |
isPrivate()
|
TorrentBuilder |
maxNumOpenFiles(int maxNumOpenFiles)
Set the max number of open files during torrent creation.
|
TorrentBuilder |
numHashingThreads(int numHashingThreads)
Set the number of threads used to create sha1 hashes for the torrent being created
any value less than 1 will use Java's common fork join pool.
|
TorrentBuilder |
pieceSize(int pieceSize)
Set the piece size of the torrent.
|
TorrentBuilder |
privateFlag(boolean isPrivate)
Set whether this torrent is a private torrent.
|
TorrentBuilder |
rootPath(Path rootPath)
Set the root path of the torrent
|
public String getAnnounce()
public Path getRootPath()
public int getPieceSize()
public TorrentBuilder addFiles(Path... files)
public TorrentBuilder addFile(Path file)
file
- the file to include in the torrentpublic TorrentBuilder announce(String announce)
public TorrentBuilder rootPath(Path rootPath)
rootPath
- the root path of the torrentpublic TorrentBuilder pieceSize(int pieceSize)
pieceSize
- the piece size of the torrentpublic String getCreatedBy()
public TorrentBuilder createdBy(String createdBy)
MetadataConstants.CREATED_BY_KEY
createdBy
- the string to put in the created by positionpublic long getCreationDate()
public TorrentBuilder creationDate(Date creationDate)
creationDate
- the creation date of the torrentpublic boolean isPrivate()
public TorrentBuilder privateFlag(boolean isPrivate)
isPrivate
- whether the torrent should be marked as privatepublic int getMaxNumOpenFiles()
public TorrentBuilder maxNumOpenFiles(int maxNumOpenFiles)
maxNumOpenFiles
- the max number of files that will be opened concurrently during torrent creation.public int getNumHashingThreads()
public TorrentBuilder numHashingThreads(int numHashingThreads)
ForkJoinPool.commonPool()
numHashingThreads
- the number of threads used to create hashespublic TorrentBuilder addAnnounceGroup(Collection<String> announceGroup)
public int getHashingBufferSize()
public TorrentBuilder hashingBufferSize(int hashingBufferSize)
hashingBufferSize
- the size of the digest bufferpublic byte[] build()
Copyright © 2016–2021. All rights reserved.