📄 totorrentfactory.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: TOTorrentFactory.java
package org.gudy.azureus2.core3.torrent;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.Map;
import org.gudy.azureus2.core3.torrent.impl.TOTorrentCreateImpl;
import org.gudy.azureus2.core3.torrent.impl.TOTorrentDeserialiseImpl;
import org.gudy.azureus2.core3.torrent.impl.TOTorrentXMLDeserialiser;
// Referenced classes of package org.gudy.azureus2.core3.torrent:
// TOTorrentException, TOTorrent, TOTorrentCreator
public class TOTorrentFactory
{
public static final long TO_DEFAULT_FIXED_PIECE_SIZE = 0x40000L;
public static final long TO_DEFAULT_VARIABLE_PIECE_SIZE_MIN = 32768L;
public static final long TO_DEFAULT_VARIABLE_PIECE_SIZE_MAX = 0x200000L;
public static final long TO_DEFAULT_VARIABLE_PIECE_NUM_LOWER = 1024L;
public static final long TO_DEFAULT_VARIABLE_PIECE_NUM_UPPER = 2048L;
public static final long STANDARD_PIECE_SIZES[] = {
32768L, 49152L, 0x10000L, 0x18000L, 0x20000L, 0x30000L, 0x40000L, 0x60000L, 0x80000L, 0xc0000L,
0x100000L, 0x180000L, 0x200000L, 0x300000L, 0x400000L
};
public TOTorrentFactory()
{
}
public static TOTorrent deserialiseFromBEncodedFile(File file)
throws TOTorrentException
{
return new TOTorrentDeserialiseImpl(file);
}
public static TOTorrent deserialiseFromBEncodedInputStream(InputStream is)
throws TOTorrentException
{
return new TOTorrentDeserialiseImpl(is);
}
public static TOTorrent deserialiseFromBEncodedByteArray(byte bytes[])
throws TOTorrentException
{
return new TOTorrentDeserialiseImpl(bytes);
}
public static TOTorrent deserialiseFromMap(Map data)
throws TOTorrentException
{
return new TOTorrentDeserialiseImpl(data);
}
public static TOTorrent deserialiseFromXMLFile(File file)
throws TOTorrentException
{
return (new TOTorrentXMLDeserialiser()).deserialise(file);
}
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url)
throws TOTorrentException
{
return createFromFileOrDirWithFixedPieceLength(file, announce_url, false, 0x40000L);
}
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url, boolean add_hashes)
throws TOTorrentException
{
return createFromFileOrDirWithFixedPieceLength(file, announce_url, add_hashes, 0x40000L);
}
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url, long piece_length)
throws TOTorrentException
{
return createFromFileOrDirWithFixedPieceLength(file, announce_url, false, piece_length);
}
public static TOTorrentCreator createFromFileOrDirWithFixedPieceLength(File file, URL announce_url, boolean add_hashes, long piece_length)
throws TOTorrentException
{
return TOTorrentCreateImpl.create(file, announce_url, add_hashes, piece_length);
}
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(File file, URL announce_url)
throws TOTorrentException
{
return createFromFileOrDirWithComputedPieceLength(file, announce_url, false);
}
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(File file, URL announce_url, boolean add_hashes)
throws TOTorrentException
{
return createFromFileOrDirWithComputedPieceLength(file, announce_url, add_hashes, 32768L, 0x200000L, 1024L, 2048L);
}
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(File file, URL announce_url, long piece_min_size, long piece_max_size, long piece_num_lower,
long piece_num_upper)
throws TOTorrentException
{
return createFromFileOrDirWithComputedPieceLength(file, announce_url, false, piece_min_size, piece_max_size, piece_num_lower, piece_num_upper);
}
public static TOTorrentCreator createFromFileOrDirWithComputedPieceLength(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
{
return TOTorrentCreateImpl.create(file, announce_url, add_hashes, piece_min_size, piece_max_size, piece_num_lower, piece_num_upper);
}
public static long getTorrentDataSizeFromFileOrDir(File file_or_dir)
{
return TOTorrentCreateImpl.getTorrentDataSizeFromFileOrDir(file_or_dir);
}
public static long getComputedPieceSize(long data_size)
{
return TOTorrentCreateImpl.getComputedPieceSize(data_size, 32768L, 0x200000L, 1024L, 2048L);
}
public static long getPieceCount(long total_size, long piece_size)
{
return TOTorrentCreateImpl.getPieceCount(total_size, piece_size);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -