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

📄 shareitemimpl.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:   ShareItemImpl.java

package org.gudy.azureus2.pluginsimpl.local.sharing;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.plugins.sharing.ShareException;
import org.gudy.azureus2.plugins.sharing.ShareItem;
import org.gudy.azureus2.plugins.torrent.Torrent;

// Referenced classes of package org.gudy.azureus2.pluginsimpl.local.sharing:
//			ShareResourceImpl

public class ShareItemImpl
	implements ShareItem
{

	protected ShareResourceImpl resource;
	protected byte fingerprint[];
	protected Torrent torrent;
	protected String torrent_save_location;

	protected ShareItemImpl(ShareResourceImpl _resource, byte _fingerprint[], Torrent _torrent)
		throws ShareException
	{
		resource = _resource;
		fingerprint = _fingerprint;
		torrent = _torrent;
		writeTorrent();
	}

	protected ShareItemImpl(ShareResourceImpl _resource, byte _fingerprint[], String _save_location)
		throws ShareException
	{
		resource = _resource;
		fingerprint = _fingerprint;
		torrent_save_location = _save_location;
	}

	public Torrent getTorrent()
		throws ShareException
	{
		if (torrent == null)
			resource.readTorrent(this);
		return torrent;
	}

	protected void writeTorrent()
		throws ShareException
	{
		if (torrent_save_location == null)
			torrent_save_location = resource.getNewTorrentLocation();
		resource.writeTorrent(this);
	}

	protected void setTorrent(Torrent _torrent)
	{
		torrent = _torrent;
	}

	public File getTorrentFile()
	{
		return resource.getTorrentFile(this);
	}

	protected String getTorrentLocation()
	{
		return torrent_save_location;
	}

	public byte[] getFingerPrint()
	{
		return fingerprint;
	}

	protected void delete()
	{
		resource.deleteTorrent(this);
	}

	protected void serialiseItem(Map map)
	{
		map.put("ihash", fingerprint);
		try
		{
			map.put("ifile", torrent_save_location.getBytes("UTF8"));
		}
		catch (UnsupportedEncodingException e)
		{
			Debug.printStackTrace(e);
		}
	}

	protected static ShareItemImpl deserialiseItem(ShareResourceImpl resource, Map map)
		throws ShareException
	{
		byte hash[];
		String save_location;
		hash = (byte[])(byte[])map.get("ihash");
		save_location = new String((byte[])(byte[])map.get("ifile"), "UTF8");
		return new ShareItemImpl(resource, hash, save_location);
		UnsupportedEncodingException e;
		e;
		throw new ShareException("internal error", e);
	}
}

⌨️ 快捷键说明

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