用的是 jBittorrentAPI.jar 解析种子文件。
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
// t1();
Object a = new Object();
File f = new File("c:\\a.torrent");
InputStream in = new FileInputStream(f);
BufferedInputStream is = new BufferedInputStream(in);
Map<String, Object> m = BDecoder.decode(is);
System.out.println("通过Map.keySet遍历key和value:");
for (String key : m.keySet()) {
System.out.println("key= " + key + " and value= " + m.get(key));
}
Map<String,Object> info = (Map) m.get("info");
Object param = info.get("name");
//这个 param 是个 int数组,但是强转却出现强制类型转换错误。。想不明白
}
接着问题又来了,种子内的文件名 理论上是 ascii 编码,但是我发现如果包含中文 就会出现负数 。。。ascii编码里没有负数,那这个是数字是什么,怎么变成中文。。
-25
-89
-69
-27
-118
-88
-24
-65
-73
-27
-82
-85
46
66
68
46
55
50
48
112
46
-27
-101
-67
-24
-117
-79
-27
-113
-116
-24
-81
-83
46
-28
-72
-83
-24
-117
-79
-27
-113
-116
-27
-83
-105
-27
-71
-107
46
109
107
118
qq_花开花谢_0
繁华开满天机
相关分类