📄 totorrentxmlserialiser.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: TOTorrentXMLSerialiser.java
package org.gudy.azureus2.core3.torrent.impl;
import java.io.*;
import java.net.URL;
import java.util.*;
import org.gudy.azureus2.core3.torrent.*;
import org.gudy.azureus2.core3.xml.util.XUXmlWriter;
// Referenced classes of package org.gudy.azureus2.core3.torrent.impl:
// TOTorrentFileImpl, TOTorrentImpl
public class TOTorrentXMLSerialiser extends XUXmlWriter
{
protected TOTorrentImpl torrent;
protected TOTorrentXMLSerialiser(TOTorrentImpl _torrent)
{
torrent = _torrent;
}
protected void serialiseToFile(File file)
throws TOTorrentException
{
Exception exception;
resetIndent();
try
{
setOutputStream(new FileOutputStream(file));
writeRoot();
}
catch (IOException e)
{
throw new TOTorrentException((new StringBuilder()).append("TOTorrentXMLSerialiser: file write fails: ").append(e.toString()).toString(), 5);
}
finally { }
try
{
closeOutputStream();
}
catch (Throwable e)
{
throw new TOTorrentException((new StringBuilder()).append("TOTorrentXMLSerialiser: file close fails: ").append(e.toString()).toString(), 5);
}
break MISSING_BLOCK_LABEL_135;
try
{
closeOutputStream();
}
catch (Throwable e)
{
throw new TOTorrentException((new StringBuilder()).append("TOTorrentXMLSerialiser: file close fails: ").append(e.toString()).toString(), 5);
}
throw exception;
}
protected void writeRoot()
throws TOTorrentException
{
writeLineRaw("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
writeLineRaw("<tor:TORRENT");
writeLineRaw("\txmlns:tor=\"http://azureus.sourceforge.net/files\"");
writeLineRaw("\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
writeLineRaw("\txsi:schemaLocation=\"http://azureus.sourceforge.net/files http://azureus.sourceforge.net/files/torrent.xsd\">");
TOTorrentAnnounceURLSet sets[];
indent();
writeTag("ANNOUNCE_URL", torrent.getAnnounceURL().toString());
sets = torrent.getAnnounceURLGroup().getAnnounceURLSets();
if (sets.length <= 0)
break MISSING_BLOCK_LABEL_189;
writeLineRaw("<ANNOUNCE_LIST>");
int i;
indent();
i = 0;
_L2:
URL urls[];
if (i >= sets.length)
break; /* Loop/switch isn't completed */
TOTorrentAnnounceURLSet set = sets[i];
urls = set.getAnnounceURLs();
writeLineRaw("<ANNOUNCE_ENTRY>");
indent();
for (int j = 0; j < urls.length; j++)
writeTag("ANNOUNCE_URL", urls[j].toString());
Exception exception;
exdent();
writeLineRaw("</ANNOUNCE_ENTRY>");
i++;
continue; /* Loop/switch isn't completed */
exception;
exdent();
throw exception;
if (true) goto _L2; else goto _L1
_L1:
exdent();
break MISSING_BLOCK_LABEL_183;
Exception exception1;
exception1;
exdent();
throw exception1;
writeLineRaw("</ANNOUNCE_LIST>");
byte comment[] = torrent.getComment();
if (comment != null)
writeLocalisableTag("COMMENT", comment);
long creation_date = torrent.getCreationDate();
if (creation_date != 0L)
writeTag("CREATION_DATE", creation_date);
byte created_by[] = torrent.getCreatedBy();
if (created_by != null)
writeLocalisableTag("CREATED_BY", created_by);
writeTag("TORRENT_HASH", torrent.getHash());
byte hash_override[] = torrent.getHashOverride();
if (hash_override != null)
writeTag("TORRENT_HASH_OVERRIDE", hash_override);
writeInfo();
Map additional_properties = torrent.getAdditionalProperties();
String key;
for (Iterator it = additional_properties.keySet().iterator(); it.hasNext(); writeGenericMapEntry(key, additional_properties.get(key)))
key = (String)it.next();
exdent();
break MISSING_BLOCK_LABEL_369;
Exception exception2;
exception2;
exdent();
throw exception2;
writeLineRaw("</tor:TORRENT>");
return;
}
protected void writeInfo()
throws TOTorrentException
{
writeLineRaw("<INFO>");
TOTorrentFileImpl files[];
indent();
writeLocalisableTag("NAME", torrent.getName());
writeTag("PIECE_LENGTH", torrent.getPieceLength());
files = (TOTorrentFileImpl[])(TOTorrentFileImpl[])torrent.getFiles();
if (torrent.isSimpleTorrent())
{
writeTag("LENGTH", files[0].getLength());
break MISSING_BLOCK_LABEL_293;
}
writeLineRaw("<FILES>");
int i;
indent();
i = 0;
_L2:
if (i >= files.length)
break; /* Loop/switch isn't completed */
writeLineRaw("<FILE>");
TOTorrentFileImpl file;
indent();
file = files[i];
writeTag("LENGTH", file.getLength());
writeLineRaw("<PATH>");
indent();
byte path_comps[][] = file.getPathComponents();
for (int j = 0; j < path_comps.length; j++)
writeLocalisableTag("COMPONENT", path_comps[j]);
exdent();
break MISSING_BLOCK_LABEL_177;
Exception exception;
exception;
exdent();
throw exception;
writeLineRaw("</PATH>");
Map additional_properties = file.getAdditionalProperties();
String key;
for (Iterator prop_it = additional_properties.keySet().iterator(); prop_it.hasNext(); writeGenericMapEntry(key, additional_properties.get(key)))
key = (String)prop_it.next();
Exception exception1;
exdent();
writeLineRaw("</FILE>");
i++;
continue; /* Loop/switch isn't completed */
exception1;
exdent();
throw exception1;
if (true) goto _L2; else goto _L1
_L1:
exdent();
break MISSING_BLOCK_LABEL_287;
Exception exception2;
exception2;
exdent();
throw exception2;
writeLineRaw("</FILES>");
writeLineRaw("<PIECES>");
indent();
byte pieces[][] = torrent.getPieces();
for (int i = 0; i < pieces.length; i++)
writeGeneric(pieces[i]);
exdent();
break MISSING_BLOCK_LABEL_348;
Exception exception3;
exception3;
exdent();
throw exception3;
writeLineRaw("</PIECES>");
Map additional_properties = torrent.getAdditionalInfoProperties();
String key;
for (Iterator it = additional_properties.keySet().iterator(); it.hasNext(); writeGenericMapEntry(key, additional_properties.get(key)))
key = (String)it.next();
exdent();
break MISSING_BLOCK_LABEL_427;
Exception exception4;
exception4;
exdent();
throw exception4;
writeLineRaw("</INFO>");
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -