FileDocCategorySizeDatePackage
TOTorrentFactory.javaAPI DocAzureus 3.0.3.46315Wed Jan 03 08:30:12 GMT 2007org.gudy.azureus2.core3.torrent

TOTorrentFactory

public class TOTorrentFactory extends Object

Fields Summary
public static final long
TO_DEFAULT_FIXED_PIECE_SIZE
public static final long
TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN
public static final long
TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX
public static final long
TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER
public static final long
TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER
public static final long[]
STANDARD_PIECE_SIZES
Constructors Summary
Methods Summary
public static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(java.io.File file, java.net.URL announce_url)

		return( createFromFileOrDirWithComputedPieceLength( file, announce_url, false ));
	
public static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(java.io.File file, java.net.URL announce_url, boolean add_hashes)

		return( createFromFileOrDirWithComputedPieceLength( 
					file, 
					announce_url,
					add_hashes,
					TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN, 
					TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX,
					TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER,
					TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER ));
					
	
public static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(java.io.File file, java.net.URL announce_url, long piece_min_size, long piece_max_size, long piece_num_lower, long piece_num_upper)

		return( createFromFileOrDirWithComputedPieceLength(
						file, announce_url, false, piece_min_size, piece_max_size,
						piece_num_lower, piece_num_upper ));

	
public static TOTorrentCreatorcreateFromFileOrDirWithComputedPieceLength(java.io.File file, java.net.URL announce_url, boolean add_hashes, long piece_min_size, long piece_max_size, long piece_num_lower, long piece_num_upper)

		return( TOTorrentCreateImpl.create(
					file, announce_url, add_hashes, piece_min_size, piece_max_size,
					piece_num_lower, piece_num_upper ));

	
public static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(java.io.File file, java.net.URL announce_url)

		return( createFromFileOrDirWithFixedPieceLength( file, announce_url, false, TO_DEFAULT_FIXED_PIECE_SIZE ));
	
public static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(java.io.File file, java.net.URL announce_url, boolean add_hashes)

		return( createFromFileOrDirWithFixedPieceLength( file, announce_url, add_hashes, TO_DEFAULT_FIXED_PIECE_SIZE ));
	
public static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(java.io.File file, java.net.URL announce_url, long piece_length)

		return( createFromFileOrDirWithFixedPieceLength( file, announce_url, false, piece_length ));
	
public static TOTorrentCreatorcreateFromFileOrDirWithFixedPieceLength(java.io.File file, java.net.URL announce_url, boolean add_hashes, long piece_length)

		return( TOTorrentCreateImpl.create( file, announce_url, add_hashes, piece_length ));
	
public static TOTorrentdeserialiseFromBEncodedByteArray(byte[] bytes)

        return( new TOTorrentDeserialiseImpl( bytes ));
    
public static TOTorrentdeserialiseFromBEncodedFile(java.io.File file)

	
		// deserialisation methods
		
	  
	
				 
		
		 
	
		return( new TOTorrentDeserialiseImpl( file ));
	
public static TOTorrentdeserialiseFromBEncodedInputStream(java.io.InputStream is)
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

param
is
return
throws
TOTorrentException

		return( new TOTorrentDeserialiseImpl( is ));
	
public static TOTorrentdeserialiseFromMap(java.util.Map data)

		return( new TOTorrentDeserialiseImpl( data ));
	
public static TOTorrentdeserialiseFromXMLFile(java.io.File file)

		return( new TOTorrentXMLDeserialiser().deserialise( file ));
	
public static longgetComputedPieceSize(long data_size)

		return( TOTorrentCreateImpl.getComputedPieceSize( 
					data_size,
					TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN, 
					TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX,
					TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER,
					TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER	));
	
public static longgetPieceCount(long total_size, long piece_size)

		return( TOTorrentCreateImpl.getPieceCount( total_size, piece_size ));
	
public static longgetTorrentDataSizeFromFileOrDir(java.io.File file_or_dir)

		return( TOTorrentCreateImpl.getTorrentDataSizeFromFileOrDir( file_or_dir ));