Class TOTorrentFactory
java.lang.Object
com.biglybt.core.torrent.TOTorrentFactory
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long[]static final longstatic final longstatic final longstatic final longstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTorrentListener(TOTorrentListener listener) static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes) static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes, long piece_min_size, long piece_max_size, long piece_num_lower, long piece_num_upper) static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(File file, URL announce_url) static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes, long piece_length) static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(File file, URL announce_url) static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(File file, URL announce_url, boolean add_hashes) static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(File file, URL announce_url, long piece_length) static TOTorrentstatic TOTorrentstatic TOTorrentWARNING - take care if you use this that the data you're creating the torrent from doesn't contain unwanted attributes in it (e.g.static TOTorrentdeserialiseFromMap(Map data) static TOTorrentdeserialiseFromXMLFile(File file) static longgetComputedPieceSize(long data_size) static longgetPieceCount(long total_size, long piece_size) static longgetTorrentDataSizeFromFileOrDir(File file_or_dir_or_desc, boolean is_layout_descriptor) static byte[]getV2RootHash(File file) static voidremoveTorrentListener(TOTorrentListener listener)
-
Field Details
-
TO_DEFAULT_FIXED_PIECE_SIZE
public static final long TO_DEFAULT_FIXED_PIECE_SIZE- See Also:
-
TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN
public static final long TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN- See Also:
-
TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX
public static final long TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX- See Also:
-
TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER
public static final long TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER- See Also:
-
TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER
public static final long TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER- See Also:
-
STANDARD_PIECE_SIZES
public static final long[] STANDARD_PIECE_SIZES
-
-
Constructor Details
-
TOTorrentFactory
public TOTorrentFactory()
-
-
Method Details
-
deserialiseFromBEncodedFile
- Throws:
TOTorrentException
-
deserialiseFromBEncodedInputStream
public static TOTorrent deserialiseFromBEncodedInputStream(InputStream is) throws TOTorrentException WARNING - take care if you use this that the data you're creating the torrent from doesn't contain unwanted attributes in it (e.g. "torrent filename"). You should almost definitely be using TorrentUtils.deserialiseFromBEncodedInputStream- Parameters:
is-- Returns:
- Throws:
TOTorrentException
-
deserialiseFromBEncodedByteArray
public static TOTorrent deserialiseFromBEncodedByteArray(TOTorrentFactory.TorrentDataHolder bytes) throws TOTorrentException - Throws:
TOTorrentException
-
deserialiseFromMap
- Throws:
TOTorrentException
-
deserialiseFromXMLFile
- Throws:
TOTorrentException
-
createFromFileOrDirWithFixedPieceLength
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithFixedPieceLength
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url, boolean add_hashes) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithFixedPieceLength
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url, long piece_length) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithFixedPieceLength
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes, long piece_length) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithComputedPieceLength
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(File file, URL announce_url) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithComputedPieceLength
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes) throws TOTorrentException - Throws:
TOTorrentException
-
createFromFileOrDirWithComputedPieceLength
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(int torrent_version, File file, URL announce_url, boolean add_hashes, long piece_min_size, long piece_max_size, long piece_num_lower, long piece_num_upper) throws TOTorrentException - Throws:
TOTorrentException
-
getTorrentDataSizeFromFileOrDir
public static long getTorrentDataSizeFromFileOrDir(File file_or_dir_or_desc, boolean is_layout_descriptor) throws TOTorrentException - Throws:
TOTorrentException
-
getComputedPieceSize
public static long getComputedPieceSize(long data_size) -
getPieceCount
public static long getPieceCount(long total_size, long piece_size) -
getV2RootHash
- Throws:
TOTorrentException
-
addTorrentListener
-
removeTorrentListener
-