Package com.biglybt.core.torrent.impl
Class TOTorrentCreateImpl
- java.lang.Object
-
- com.biglybt.core.logging.LogRelation
-
- com.biglybt.core.torrent.impl.TOTorrentImpl
-
- com.biglybt.core.torrent.impl.TOTorrentCreateImpl
-
- All Implemented Interfaces:
TOTorrentFileHasherListener
,TOTorrent
public class TOTorrentCreateImpl extends TOTorrentImpl implements TOTorrentFileHasherListener
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
add_other_hashes
private boolean
add_pad_files
private boolean
add_v1
private boolean
add_v2
private boolean
cancelled
private static java.util.Comparator<java.io.File>
file_comparator
private static java.util.Comparator<java.io.File>
file_comparator_v2
private TOTorrentFileHasher
file_hasher
private java.util.Set<java.lang.String>
ignore_set
private java.util.Map<java.lang.String,java.io.File>
linkage_map
private java.util.Map<java.lang.String,java.lang.String>
linked_tf_map
private int
pad_file_num
private long
pad_file_sizes
private long
piece_count_no_pad
private long
piece_length
private java.util.List<TOTorrentProgressListener>
progress_listeners
private int
reported_progress
private java.io.File
torrent_base
private int
torrent_type
private long
total_file_count_no_pad
private long
total_file_size_no_pad
-
Fields inherited from class com.biglybt.core.torrent.impl.TOTorrentImpl
this_mon, TK_ADDITIONAL_OK_ATTRS, TK_ANNOUNCE, TK_ANNOUNCE_LIST, TK_BEP47_ATTRS, TK_COMMENT, TK_COMMENT_UTF8, TK_CREATED_BY, TK_CREATION_DATE, TK_ENCODING, TK_FILES, TK_HASH_OVERRIDE, TK_INFO, TK_LENGTH, TK_NAME, TK_NAME_UTF8, TK_PATH, TK_PATH_UTF8, TK_PIECE_LENGTH, TK_PIECES, TK_PRIVATE, TK_SOURCE, TK_V2_FILE_TREE, TK_V2_META_VERSION, TK_V2_PIECE_LAYERS, TK_V2_PIECES_ROOT, TK_WEBSEED_BT, TK_WEBSEED_GR
-
Fields inherited from interface com.biglybt.core.torrent.TOTorrent
AZUREUS_PRIVATE_PROPERTIES, AZUREUS_PROPERTIES, DEFAULT_IGNORE_FILES, ENCODING_ACTUALLY_UTF8_KEYS, TT_V1, TT_V1_V2, TT_V2
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TOTorrentCreateImpl(int _torrent_type, java.util.Map<java.lang.String,java.io.File> _linkage_map, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_length)
protected
TOTorrentCreateImpl(int _torrent_type, java.util.Map<java.lang.String,java.io.File> _linkage_map, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_min_size, long _piece_max_size, long _piece_num_lower, long _piece_num_upper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addListener(TOTorrentProgressListener listener)
protected long
calculateNumberOfPieces(java.io.File _file, long _piece_length)
protected long
calculateTotalFileSize(java.io.File file)
protected void
cancel()
protected void
create(boolean skip_hashing)
private int
createV1(boolean skip_hashing)
private int
createV2(boolean skip_hashing)
static long
getComputedPieceSize(long total_size, long _piece_min_size, long _piece_max_size, long _piece_num_lower, long _piece_num_upper)
static long
getPieceCount(long total_size, long piece_size)
protected long
getTotalFileSize(java.io.File file)
protected long
getTotalFileSizeSupport(java.io.File file, java.lang.String root)
private boolean
ignoreFile(java.lang.String file)
void
pieceHashed(int piece_number)
private int
processDir(TOTorrentFileHasher hasher, java.io.File dir, java.util.List<TOTorrentFileImpl> encoded, java.lang.String base_name, java.lang.String root, long[] torrent_offset)
protected void
removeListener(TOTorrentProgressListener listener)
protected void
report(java.lang.String resource_key)
protected void
report(java.lang.String resource_key, long bytes)
protected void
report(java.lang.String resource_key, java.lang.String additional_text)
private void
setIgnoreList()
-
Methods inherited from class com.biglybt.core.torrent.impl.TOTorrentImpl
addAdditionalInfoProperty, addAdditionalProperty, addGlobalListener, addListener, addTorrentAnnounceURLSet, anonymityTransform, fireChanged, fixupRootHashes, getAdditionalByteArrayProperty, getAdditionalInfoProperties, getAdditionalListProperty, getAdditionalLongProperty, getAdditionalMapProperty, getAdditionalProperties, getAdditionalProperty, getAdditionalStringProperty, getAnnounceURL, getAnnounceURLGroup, getComment, getCreatedBy, getCreationDate, getFileCount, getFiles, getFullHash, getHash, getHashOverride, getHashWrapper, getMonitor, getName, getNumberOfPieces, getPieceLength, getPieces, getPrivate, getQueryableInterfaces, getRelationText, getSimpleTorrent, getSize, getSource, getTorrentType, getUTF8Name, hasSameHashAs, isCreated, isDecentralised, isExportable, isSimpleTorrent, print, readStringFromMetaData, readStringFromMetaData, removeAdditionalProperties, removeAdditionalProperty, removeGlobalListener, removeListener, selectHybridHashType, serialiseToBEncodedFile, serialiseToByteArray, serialiseToMap, serialiseToXMLFile, setAdditionalByteArrayProperty, setAdditionalListProperty, setAdditionalLongProperty, setAdditionalMapProperty, setAdditionalProperty, setAdditionalStringProperty, setAnnounceURL, setComment, setComment, setConstructed, setCreatedBy, setCreatedBy, setCreationDate, setFiles, setHashFromInfo, setHashOverride, setName, setNameUTF8, setPiece, setPieceLength, setPieces, setPrivate, setSimpleTorrent, setSource, setTorrentType, updateExportability, writeStringToMetaData, writeStringToMetaData
-
Methods inherited from class com.biglybt.core.logging.LogRelation
propogatedRelationText, queryForClass
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.core.torrent.TOTorrent
getEffectiveTorrentType, getTruncatedHash
-
-
-
-
Field Detail
-
file_comparator
private static final java.util.Comparator<java.io.File> file_comparator
-
file_comparator_v2
private static final java.util.Comparator<java.io.File> file_comparator_v2
-
torrent_type
private final int torrent_type
-
torrent_base
private java.io.File torrent_base
-
piece_length
private long piece_length
-
file_hasher
private TOTorrentFileHasher file_hasher
-
total_file_size_no_pad
private long total_file_size_no_pad
-
total_file_count_no_pad
private long total_file_count_no_pad
-
piece_count_no_pad
private long piece_count_no_pad
-
add_other_hashes
private boolean add_other_hashes
-
add_pad_files
private boolean add_pad_files
-
pad_file_num
private int pad_file_num
-
pad_file_sizes
private long pad_file_sizes
-
add_v1
private final boolean add_v1
-
add_v2
private final boolean add_v2
-
progress_listeners
private final java.util.List<TOTorrentProgressListener> progress_listeners
-
reported_progress
private int reported_progress
-
ignore_set
private java.util.Set<java.lang.String> ignore_set
-
linkage_map
private java.util.Map<java.lang.String,java.io.File> linkage_map
-
linked_tf_map
private final java.util.Map<java.lang.String,java.lang.String> linked_tf_map
-
cancelled
private volatile boolean cancelled
-
-
Constructor Detail
-
TOTorrentCreateImpl
protected TOTorrentCreateImpl(int _torrent_type, java.util.Map<java.lang.String,java.io.File> _linkage_map, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_length) throws TOTorrentException
- Throws:
TOTorrentException
-
TOTorrentCreateImpl
protected TOTorrentCreateImpl(int _torrent_type, java.util.Map<java.lang.String,java.io.File> _linkage_map, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_min_size, long _piece_max_size, long _piece_num_lower, long _piece_num_upper) throws TOTorrentException
- Throws:
TOTorrentException
-
-
Method Detail
-
create
protected void create(boolean skip_hashing) throws TOTorrentException
- Throws:
TOTorrentException
-
createV1
private int createV1(boolean skip_hashing) throws TOTorrentException
- Throws:
TOTorrentException
-
createV2
private int createV2(boolean skip_hashing) throws TOTorrentException
- Throws:
TOTorrentException
-
processDir
private int processDir(TOTorrentFileHasher hasher, java.io.File dir, java.util.List<TOTorrentFileImpl> encoded, java.lang.String base_name, java.lang.String root, long[] torrent_offset) throws TOTorrentException
- Throws:
TOTorrentException
-
pieceHashed
public void pieceHashed(int piece_number)
- Specified by:
pieceHashed
in interfaceTOTorrentFileHasherListener
-
calculateNumberOfPieces
protected long calculateNumberOfPieces(java.io.File _file, long _piece_length) throws TOTorrentException
- Throws:
TOTorrentException
-
calculateTotalFileSize
protected long calculateTotalFileSize(java.io.File file) throws TOTorrentException
- Throws:
TOTorrentException
-
getTotalFileSize
protected long getTotalFileSize(java.io.File file) throws TOTorrentException
- Throws:
TOTorrentException
-
getTotalFileSizeSupport
protected long getTotalFileSizeSupport(java.io.File file, java.lang.String root) throws TOTorrentException
- Throws:
TOTorrentException
-
report
protected void report(java.lang.String resource_key)
-
report
protected void report(java.lang.String resource_key, long bytes)
-
report
protected void report(java.lang.String resource_key, java.lang.String additional_text)
-
getComputedPieceSize
public static long getComputedPieceSize(long total_size, long _piece_min_size, long _piece_max_size, long _piece_num_lower, long _piece_num_upper)
-
getPieceCount
public static long getPieceCount(long total_size, long piece_size)
-
setIgnoreList
private void setIgnoreList()
-
ignoreFile
private boolean ignoreFile(java.lang.String file)
-
cancel
protected void cancel()
-
addListener
protected void addListener(TOTorrentProgressListener listener)
-
removeListener
protected void removeListener(TOTorrentProgressListener listener)
-
-