📄 main.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: Main.java
package org.gudy.azureus2.core3.torrent.test;
import java.io.File;
import java.io.PrintStream;
import java.net.URL;
import org.gudy.azureus2.core3.security.SESecurityManager;
import org.gudy.azureus2.core3.torrent.*;
import org.gudy.azureus2.core3.util.Debug;
public class Main
{
static int TT_ENCODE = 1;
static int TT_DECODE = 2;
static int TT_CREATE = 3;
public Main()
{
}
static void usage()
{
System.err.println("Usage: encode|decode|create");
SESecurityManager.exitVM(1);
}
public static void main(String args[])
{
int test_type = 0;
if (args.length != 1)
usage();
if (args[0].equalsIgnoreCase("encode"))
test_type = TT_ENCODE;
else
if (args[0].equalsIgnoreCase("decode"))
test_type = TT_DECODE;
else
if (args[0].equalsIgnoreCase("create"))
test_type = TT_CREATE;
else
usage();
try
{
if (test_type != TT_ENCODE)
if (test_type == TT_DECODE)
{
File f = new File("c:\\temp\\az3008-broken.torrent");
TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedFile(f);
torrent.print();
} else
if (test_type == TT_CREATE)
{
TOTorrentProgressListener list = new TOTorrentProgressListener() {
public void reportProgress(int p)
{
System.out.println((new StringBuilder()).append("").append(p).toString());
}
public void reportCurrentTask(String task_description)
{
System.out.println((new StringBuilder()).append("task = ").append(task_description).toString());
}
};
boolean do_file = false;
boolean do_fixed = false;
TOTorrent t;
if (do_fixed)
{
if (do_file)
{
TOTorrentCreator c = TOTorrentFactory.createFromFileOrDirWithFixedPieceLength(new File("c:\\temp\\test.wmf"), new URL("http://127.0.0.1:6969/announce"), 10240L);
c.addListener(list);
t = c.create();
} else
{
TOTorrentCreator c = TOTorrentFactory.createFromFileOrDirWithFixedPieceLength(new File("c:\\temp\\scans"), new URL("http://127.0.0.1:6969/announce"), 0x40000L);
c.addListener(list);
t = c.create();
}
} else
if (do_file)
{
TOTorrentCreator c = TOTorrentFactory.createFromFileOrDirWithComputedPieceLength(new File("c:\\temp\\test.wmf"), new URL("http://127.0.0.1:6969/announce"));
c.addListener(list);
t = c.create();
} else
{
TOTorrentCreator c = TOTorrentFactory.createFromFileOrDirWithComputedPieceLength(new File("c:\\temp\\qqq"), new URL("http://127.0.0.1:6969/announce"));
c.addListener(list);
t = c.create();
t.setCreationDate(12345L);
t.setComment("poo pee plop mcjock");
}
t.print();
t.serialiseToBEncodedFile(new File("c:\\temp\\test.torrent"));
}
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -