⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statswriterimpl.java

📁 java 文件下载器。可自定义
💻 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:   StatsWriterImpl.java

package org.gudy.azureus2.core3.stats.impl;

import com.aelitis.azureus.core.AzureusCore;
import com.aelitis.azureus.core.peermanager.utils.PeerClassifier;
import java.io.*;
import java.util.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.download.DownloadManagerStats;
import org.gudy.azureus2.core3.global.GlobalManager;
import org.gudy.azureus2.core3.global.GlobalManagerStats;
import org.gudy.azureus2.core3.peer.*;
import org.gudy.azureus2.core3.torrent.TOTorrent;
import org.gudy.azureus2.core3.torrent.TOTorrentFile;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.core3.xml.util.XUXmlWriter;

public class StatsWriterImpl extends XUXmlWriter
{

	AzureusCore core;

	protected StatsWriterImpl(AzureusCore _core)
	{
		core = _core;
	}

	protected void write(String file_name)
		throws IOException
	{
		setOutputStream(new FileOutputStream(file_name));
		writeSupport();
		closeOutputStream();
		break MISSING_BLOCK_LABEL_30;
		Exception exception;
		exception;
		closeOutputStream();
		throw exception;
	}

	protected void write(OutputStream os)
		throws IOException
	{
		setOutputStream(os);
		writeSupport();
		flushOutputStream();
		break MISSING_BLOCK_LABEL_23;
		Exception exception;
		exception;
		flushOutputStream();
		throw exception;
	}

	protected void writeSupport()
	{
		boolean export_peer_stats;
		boolean export_file_stats;
		GlobalManager global;
		writeLineRaw("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		export_peer_stats = COConfigurationManager.getBooleanParameter("Stats Export Peer Details");
		export_file_stats = COConfigurationManager.getBooleanParameter("Stats Export File Details");
		String xsl = COConfigurationManager.getStringParameter("Stats XSL File");
		if (xsl.length() > 0)
			writeLineRaw((new StringBuilder()).append("<?xml-stylesheet type=\"text/xsl\" href=\"").append(xsl).append("\"?>").toString());
		writeLineRaw("<STATS>");
		global = core.getGlobalManager();
		indent();
		writeTag("AZUREUS_VERSION", "4.2.0.0");
		writeLineRaw("<GLOBAL>");
		indent();
		GlobalManagerStats gm_stats = global.getStats();
		writeRawCookedAverageTag("DOWNLOAD_SPEED", gm_stats.getDataReceiveRate() + gm_stats.getProtocolReceiveRate());
		writeRawCookedAverageTag("UPLOAD_SPEED", gm_stats.getDataSendRate() + gm_stats.getProtocolSendRate());
		exdent();
		break MISSING_BLOCK_LABEL_167;
		Exception exception;
		exception;
		exdent();
		throw exception;
		writeLineRaw("</GLOBAL>");
		writeLineRaw("<DOWNLOADS>");
		DownloadManager dms[];
		int i;
		indent();
		List _dms = global.getDownloadManagers();
		dms = new DownloadManager[_dms.size()];
		_dms.toArray(dms);
		Arrays.sort(dms, new Comparator() {

			final StatsWriterImpl this$0;

			public int compare(Object o1, Object o2)
			{
				DownloadManager d1 = (DownloadManager)o1;
				DownloadManager d2 = (DownloadManager)o2;
				int d1_index = d1.getPosition();
				int d2_index = d2.getPosition();
				if (d1.isDownloadComplete(false))
					d1_index += 0xf4240;
				if (d2.isDownloadComplete(false))
					d2_index += 0xf4240;
				return d1_index - d2_index;
			}

			
			{
				this$0 = StatsWriterImpl.this;
				super();
			}
		});
		i = 0;
_L7:
		DownloadManager dm;
		DownloadManagerStats dm_stats;
		if (i >= dms.length)
			break; /* Loop/switch isn't completed */
		dm = dms[i];
		dm_stats = dm.getStats();
		writeLineRaw("<DOWNLOAD>");
		TOTorrent torrent;
		indent();
		writeLineRaw("<TORRENT>");
		torrent = dm.getTorrent();
		indent();
		writeTag("NAME", dm.getDisplayName());
		writeTag("TORRENT_FILE", dm.getTorrentFileName());
		if (torrent != null)
		{
			writeTag("HASH", TorrentUtils.nicePrintTorrentHash(torrent, true));
			writeRawCookedTag("SIZE", torrent.getSize());
			writeTag("PIECE_LENGTH", torrent.getPieceLength());
			writeTag("PIECE_COUNT", torrent.getNumberOfPieces());
			writeTag("FILE_COUNT", torrent.getFiles().length);
			writeTag("COMMENT", dm.getTorrentComment());
			writeTag("CREATED_BY", dm.getTorrentCreatedBy());
			writeTag("CREATION_DATE", torrent.getCreationDate());
		}
		exdent();
		break MISSING_BLOCK_LABEL_436;
		Exception exception1;
		exception1;
		exdent();
		throw exception1;
		writeLineRaw("</TORRENT>");
		writeTag("DOWNLOAD_STATUS", DisplayFormatters.formatDownloadStatusDefaultLocale(dm));
		writeTag("DOWNLOAD_DIR", dm.getSaveLocation().toString());
		if (torrent != null)
			if (torrent.isSimpleTorrent())
				writeTag("TARGET_FILE", dm.getSaveLocation().toString());
			else
				writeTag("TARGET_DIR", dm.getSaveLocation().toString());
		writeTag("TRACKER_STATUS", dm.getTrackerStatus());
		writeTag("COMPLETED", dm_stats.getCompleted());
		writeTag("NON_DND_COMPLETED", dm.isDownloadComplete(false));
		writeRawCookedTag("DOWNLOADED", dm_stats.getTotalDataBytesReceived());
		writeRawCookedTag("UPLOADED", dm_stats.getTotalDataBytesSent());
		writeRawCookedTag("DISCARDED", dm_stats.getDiscarded());
		writeRawCookedAverageTag("DOWNLOAD_SPEED", dm_stats.getDataReceiveRate());
		writeRawCookedAverageTag("UPLOAD_SPEED", dm_stats.getDataSendRate());
		writeRawCookedAverageTag("TOTAL_SPEED", dm_stats.getTotalAverage());
		writeTag("ELAPSED", dm_stats.getElapsedTime());
		writeTag("ETA", DisplayFormatters.formatETA(dm_stats.getETA()));
		writeTag("HASH_FAILS", dm_stats.getHashFailCount());
		writeTag("SHARE_RATIO", dm_stats.getShareRatio());
		writeTag("TOTAL_SEEDS", dm.getNbSeeds());
		writeTag("TOTAL_LEECHERS", dm.getNbPeers());
		if (!export_file_stats)
			break MISSING_BLOCK_LABEL_892;
		DiskManagerFileInfo files[];
		int j;
		writeLineRaw("<FILES>");
		indent();
		files = dm.getDiskManagerFileInfo();
		j = 0;
_L2:
		DiskManagerFileInfo file;
		if (j >= files.length)
			break; /* Loop/switch isn't completed */
		file = files[j];
		writeLineRaw("<FILE>");
		indent();
		writeTag("NAME", file.getTorrentFile().getRelativePath());
		writeTag("DND", file.isSkipped());
		writeRawCookedTag("SIZE", file.getLength());
		writeRawCookedTag("DOWNLOADED", file.getDownloaded());
		exdent();
		Exception exception2;
		writeLineRaw("</FILE>");
		j++;
		continue; /* Loop/switch isn't completed */
		exception2;
		exdent();
		writeLineRaw("</FILE>");
		throw exception2;
		if (true) goto _L2; else goto _L1
_L1:
		exdent();
		writeLineRaw("</FILES>");
		break MISSING_BLOCK_LABEL_892;
		Exception exception3;
		exception3;
		exdent();
		writeLineRaw("</FILES>");
		throw exception3;
		if (!export_peer_stats)
			break MISSING_BLOCK_LABEL_1226;
		List peers;
		int j;
		writeLineRaw("<PEERS>");
		indent();
		PEPeerManager pm = dm.getPeerManager();
		if (pm == null)
			break MISSING_BLOCK_LABEL_1198;
		peers = pm.getPeers();
		j = 0;
_L5:
		if (j >= peers.size()) goto _L4; else goto _L3
_L3:
		PEPeer peer;
		PEPeerStats peer_stats;
		byte id[];
		peer = (PEPeer)peers.get(j);
		peer_stats = peer.getStats();
		id = peer.getId();
		if (id == null)
			continue; /* Loop/switch isn't completed */
		String peer_id = PeerClassifier.getPrintablePeerID(id);
		peer_id = escapeXML(peer_id);
		String type = escapeXML(peer.getClient());
		writeLineRaw((new StringBuilder()).append("<PEER hex_id=\"").append(ByteFormatter.encodeString(id)).append("\" printable_id=\"").append(peer_id).append("\" type=\"").append(type).append("\">").toString());
		indent();
		writeTag("IP", peer.getIp());
		writeTag("IS_SEED", peer.isSeed());
		writeRawCookedTag("DOWNLOADED", peer_stats.getTotalDataBytesReceived());
		writeRawCookedTag("UPLOADED", peer_stats.getTotalDataBytesSent());
		writeRawCookedAverageTag("DOWNLOAD_SPEED", peer_stats.getDataReceiveRate());
		writeRawCookedAverageTag("UPLOAD_SPEED", peer_stats.getDataSendRate());
		exdent();
		writeLineRaw("</PEER>");
		continue; /* Loop/switch isn't completed */
		Throwable e;
		e;
		Debug.printStackTrace(e);
		exdent();
		writeLineRaw("</PEER>");
		continue; /* Loop/switch isn't completed */
		Exception exception4;
		exception4;
		exdent();
		writeLineRaw("</PEER>");
		throw exception4;
		j++;
		  goto _L5
_L4:
		exdent();
		writeLineRaw("</PEERS>");
		break MISSING_BLOCK_LABEL_1226;
		Exception exception5;
		exception5;
		exdent();
		writeLineRaw("</PEERS>");
		throw exception5;
		Exception exception6;
		exdent();
		writeLineRaw("</DOWNLOAD>");
		i++;
		continue; /* Loop/switch isn't completed */
		exception6;
		exdent();
		throw exception6;
		if (true) goto _L7; else goto _L6
_L6:
		exdent();
		break MISSING_BLOCK_LABEL_1270;
		Exception exception7;
		exception7;
		exdent();
		throw exception7;
		writeLineRaw("</DOWNLOADS>");
		exdent();
		break MISSING_BLOCK_LABEL_1292;
		Exception exception8;
		exception8;
		exdent();
		throw exception8;
		writeLineRaw("</STATS>");
		return;
	}

	protected void writeRawCookedTag(String tag, long raw)
	{
		writeLineRaw((new StringBuilder()).append("<").append(tag).append(">").toString());
		indent();
		writeTag("TEXT", DisplayFormatters.formatByteCountToKiBEtc(raw));
		writeTag("RAW", raw);
		exdent();
		break MISSING_BLOCK_LABEL_65;
		Exception exception;
		exception;
		exdent();
		throw exception;
		writeLineRaw((new StringBuilder()).append("</").append(tag).append(">").toString());
		return;
	}

	protected void writeRawCookedAverageTag(String tag, long raw)
	{
		writeLineRaw((new StringBuilder()).append("<").append(tag).append(">").toString());
		indent();
		writeTag("TEXT", DisplayFormatters.formatByteCountToKiBEtcPerSec(raw));
		writeTag("RAW", raw);
		exdent();
		break MISSING_BLOCK_LABEL_65;
		Exception exception;
		exception;
		exdent();
		throw exception;
		writeLineRaw((new StringBuilder()).append("</").append(tag).append(">").toString());
		return;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -