Package com.biglybt.core.torrent.impl
Class TOTorrentCreatorImpl
- java.lang.Object
-
- com.biglybt.core.torrent.impl.TOTorrentCreatorImpl
-
- All Implemented Interfaces:
TOTorrentCreator
public class TOTorrentCreatorImpl extends java.lang.Object implements TOTorrentCreator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
TOTorrentCreatorImpl.DescEntry
-
Field Summary
Fields Modifier and Type Field Description private boolean
add_other_hashes
private java.net.URL
announce_url
private java.io.File
descriptor_dir
private boolean
is_desc
private java.util.Map<java.lang.String,java.io.File>
linkage_map
private java.util.List<TOTorrentProgressListener>
listeners
private long
piece_length
private long
piece_max_size
private long
piece_min_size
private long
piece_num_lower
private long
piece_num_upper
private TOTorrentCreateImpl
torrent
private java.io.File
torrent_base
private int
torrent_type
-
Constructor Summary
Constructors Constructor Description TOTorrentCreatorImpl(int _torrent_type, java.io.File _torrent_base)
TOTorrentCreatorImpl(int _torrent_type, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_length)
TOTorrentCreatorImpl(int _torrent_type, 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 Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(TOTorrentProgressListener listener)
void
cancel()
TOTorrent
create()
TOTorrent
create(boolean skip_hashing)
private java.io.File
createLayoutMap()
private void
destroyLayoutMap()
long
getTorrentDataSizeFromFileOrDir()
private long
getTorrentDataSizeFromFileOrDir(java.io.File file)
private void
mapDirectory(int prefix_length, java.io.File target, java.io.File temp)
private java.util.List<TOTorrentCreatorImpl.DescEntry>
readDescriptor()
void
removeListener(TOTorrentProgressListener listener)
void
setFileIsLayoutDescriptor(boolean b)
A 'layout descriptor' is a file that explicitly details the construction of the torrent from a collection of files, rather than relying on a natural file system structure.
-
-
-
Field Detail
-
torrent_type
private final int torrent_type
-
torrent_base
private final java.io.File torrent_base
-
announce_url
private java.net.URL announce_url
-
add_other_hashes
private boolean add_other_hashes
-
piece_length
private long piece_length
-
piece_min_size
private long piece_min_size
-
piece_max_size
private long piece_max_size
-
piece_num_lower
private long piece_num_lower
-
piece_num_upper
private long piece_num_upper
-
is_desc
private boolean is_desc
-
linkage_map
private final java.util.Map<java.lang.String,java.io.File> linkage_map
-
descriptor_dir
private java.io.File descriptor_dir
-
torrent
private TOTorrentCreateImpl torrent
-
listeners
private final java.util.List<TOTorrentProgressListener> listeners
-
-
Constructor Detail
-
TOTorrentCreatorImpl
public TOTorrentCreatorImpl(int _torrent_type, java.io.File _torrent_base)
-
TOTorrentCreatorImpl
public TOTorrentCreatorImpl(int _torrent_type, java.io.File _torrent_base, java.net.URL _announce_url, boolean _add_other_hashes, long _piece_length) throws TOTorrentException
- Throws:
TOTorrentException
-
TOTorrentCreatorImpl
public TOTorrentCreatorImpl(int _torrent_type, 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
-
setFileIsLayoutDescriptor
public void setFileIsLayoutDescriptor(boolean b)
Description copied from interface:TOTorrentCreator
A 'layout descriptor' is a file that explicitly details the construction of the torrent from a collection of files, rather than relying on a natural file system structure. The file is bencoded and consists of a Map with a List- Specified by:
setFileIsLayoutDescriptor
in interfaceTOTorrentCreator
-
create
public TOTorrent create() throws TOTorrentException
- Specified by:
create
in interfaceTOTorrentCreator
- Throws:
TOTorrentException
-
create
public TOTorrent create(boolean skip_hashing) throws TOTorrentException
- Specified by:
create
in interfaceTOTorrentCreator
- Throws:
TOTorrentException
-
readDescriptor
private java.util.List<TOTorrentCreatorImpl.DescEntry> readDescriptor() throws TOTorrentException
- Throws:
TOTorrentException
-
mapDirectory
private void mapDirectory(int prefix_length, java.io.File target, java.io.File temp) throws java.io.IOException
- Throws:
java.io.IOException
-
createLayoutMap
private java.io.File createLayoutMap() throws TOTorrentException
- Throws:
TOTorrentException
-
destroyLayoutMap
private void destroyLayoutMap()
-
getTorrentDataSizeFromFileOrDir
public long getTorrentDataSizeFromFileOrDir() throws TOTorrentException
- Specified by:
getTorrentDataSizeFromFileOrDir
in interfaceTOTorrentCreator
- Throws:
TOTorrentException
-
getTorrentDataSizeFromFileOrDir
private long getTorrentDataSizeFromFileOrDir(java.io.File file)
-
cancel
public void cancel()
- Specified by:
cancel
in interfaceTOTorrentCreator
-
addListener
public void addListener(TOTorrentProgressListener listener)
- Specified by:
addListener
in interfaceTOTorrentCreator
-
removeListener
public void removeListener(TOTorrentProgressListener listener)
- Specified by:
removeListener
in interfaceTOTorrentCreator
-
-