📄 rpdownload.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: RPDownload.java
package org.gudy.azureus2.pluginsimpl.remote.download;
import java.io.File;
import java.util.Map;
import org.gudy.azureus2.plugins.disk.DiskManager;
import org.gudy.azureus2.plugins.disk.DiskManagerFileInfo;
import org.gudy.azureus2.plugins.download.*;
import org.gudy.azureus2.plugins.download.savelocation.SaveLocationChange;
import org.gudy.azureus2.plugins.peers.PeerManager;
import org.gudy.azureus2.plugins.torrent.Torrent;
import org.gudy.azureus2.plugins.torrent.TorrentAttribute;
import org.gudy.azureus2.pluginsimpl.remote.*;
import org.gudy.azureus2.pluginsimpl.remote.disk.RPDiskManagerFileInfo;
import org.gudy.azureus2.pluginsimpl.remote.torrent.RPTorrent;
// Referenced classes of package org.gudy.azureus2.pluginsimpl.remote.download:
// RPDownloadAnnounceResult, RPDownloadScrapeResult, RPDownloadStats
public class RPDownload extends RPObject
implements Download
{
protected transient Download delegate;
public RPTorrent torrent;
public RPDownloadStats stats;
public RPDownloadAnnounceResult announce_result;
public RPDownloadScrapeResult scrape_result;
public int position;
public boolean force_start;
public static RPDownload create(Download _delegate)
{
RPDownload res = (RPDownload)_lookupLocal(_delegate);
if (res == null)
res = new RPDownload(_delegate);
return res;
}
protected RPDownload(Download _delegate)
{
super(_delegate);
if (delegate.getTorrent() != null)
{
torrent = (RPTorrent)_lookupLocal(delegate.getTorrent());
if (torrent == null)
torrent = RPTorrent.create(delegate.getTorrent());
}
stats = (RPDownloadStats)_lookupLocal(delegate.getStats());
if (stats == null)
stats = RPDownloadStats.create(delegate.getStats());
announce_result = (RPDownloadAnnounceResult)_lookupLocal(delegate.getLastAnnounceResult());
if (announce_result == null)
announce_result = RPDownloadAnnounceResult.create(delegate.getLastAnnounceResult());
scrape_result = (RPDownloadScrapeResult)_lookupLocal(delegate.getLastScrapeResult());
if (scrape_result == null)
scrape_result = RPDownloadScrapeResult.create(delegate.getLastScrapeResult());
}
protected void _setDelegate(Object _delegate)
{
delegate = (Download)_delegate;
position = delegate.getPosition();
force_start = delegate.isForceStart();
}
public Object _setLocal()
throws RPException
{
Object res = _fixupLocal();
if (torrent != null)
torrent._setLocal();
stats._setLocal();
announce_result._setLocal();
scrape_result._setLocal();
return res;
}
public void _setRemote(RPRequestDispatcher dispatcher)
{
super._setRemote(dispatcher);
if (torrent != null)
torrent._setRemote(dispatcher);
stats._setRemote(dispatcher);
announce_result._setRemote(dispatcher);
scrape_result._setRemote(dispatcher);
}
public RPReply _process(RPRequest request)
{
String method = request.getMethod();
if (method.equals("initialize"))
{
try
{
delegate.initialize();
}
catch (DownloadException e)
{
return new RPReply(e);
}
return null;
}
if (method.equals("start"))
{
try
{
delegate.start();
}
catch (DownloadException e)
{
return new RPReply(e);
}
return null;
}
if (method.equals("restart"))
{
try
{
delegate.restart();
}
catch (DownloadException e)
{
return new RPReply(e);
}
return null;
}
if (method.equals("stop"))
{
try
{
delegate.stop();
}
catch (DownloadException e)
{
return new RPReply(e);
}
return null;
}
if (method.equals("remove"))
{
try
{
delegate.remove();
}
catch (Throwable e)
{
return new RPReply(e);
}
return null;
}
if (method.equals("setForceStart[boolean]"))
{
boolean b = ((Boolean)request.getParams()[0]).booleanValue();
delegate.setForceStart(b);
return null;
}
if (method.equals("setPosition[int]"))
{
int p = ((Integer)request.getParams()[0]).intValue();
delegate.setPosition(p);
return null;
}
if (method.equals("moveUp"))
{
delegate.moveUp();
return null;
}
if (method.equals("moveDown"))
{
delegate.moveDown();
return null;
}
if (method.equals("moveTo[int]"))
{
int p = ((Integer)request.getParams()[0]).intValue();
delegate.setPosition(p);
return null;
}
if (method.equals("setPriority[int]"))
{
delegate.setPriority(((Integer)request.getParams()[0]).intValue());
return null;
}
if (method.equals("requestTrackerAnnounce"))
{
delegate.requestTrackerAnnounce();
return null;
}
if (method.equals("getDiskManagerFileInfo"))
{
DiskManagerFileInfo info[] = delegate.getDiskManagerFileInfo();
RPDiskManagerFileInfo rp_info[] = new RPDiskManagerFileInfo[info.length];
for (int i = 0; i < rp_info.length; i++)
rp_info[i] = RPDiskManagerFileInfo.create(info[i]);
return new RPReply(rp_info);
} else
{
throw new RPException((new StringBuilder()).append("Unknown method: ").append(method).toString());
}
}
public int getState()
{
notSupported();
return 0;
}
public int getSubState()
{
notSupported();
return 0;
}
public String getErrorStateDetails()
{
notSupported();
return null;
}
public boolean getFlag(long flag)
{
notSupported();
return false;
}
public int getIndex()
{
notSupported();
return 0;
}
public Torrent getTorrent()
{
return torrent;
}
public byte[] getDownloadPeerId()
{
return delegate.getDownloadPeerId();
}
public boolean isMessagingEnabled()
{
return delegate.isMessagingEnabled();
}
public void setMessagingEnabled(boolean enabled)
{
delegate.setMessagingEnabled(enabled);
}
public void initialize()
throws DownloadException
{
try
{
_dispatcher.dispatch(new RPRequest(this, "initialize", null)).getResponse();
}
catch (RPException e)
{
if (e.getCause() instanceof DownloadException)
throw (DownloadException)e.getCause();
else
throw e;
}
}
public void start()
throws DownloadException
{
try
{
_dispatcher.dispatch(new RPRequest(this, "start", null)).getResponse();
}
catch (RPException e)
{
if (e.getCause() instanceof DownloadException)
throw (DownloadException)e.getCause();
else
throw e;
}
}
public void stop()
throws DownloadException
{
try
{
_dispatcher.dispatch(new RPRequest(this, "stop", null)).getResponse();
}
catch (RPException e)
{
if (e.getCause() instanceof DownloadException)
throw (DownloadException)e.getCause();
else
throw e;
}
}
public void restart()
throws DownloadException
{
try
{
_dispatcher.dispatch(new RPRequest(this, "restart", null)).getResponse();
}
catch (RPException e)
{
if (e.getCause() instanceof DownloadException)
throw (DownloadException)e.getCause();
else
throw e;
}
}
public boolean isStartStopLocked()
{
notSupported();
return false;
}
public boolean isPaused()
{
notSupported();
return false;
}
public void pause()
{
notSupported();
}
public void resume()
{
notSupported();
}
public int getPriority()
{
return 0;
}
public void setPriority(int i)
{
}
/**
* @deprecated Method isPriorityLocked is deprecated
*/
public boolean isPriorityLocked()
{
return false;
}
public void remove()
throws DownloadException, DownloadRemovalVetoException
{
try
{
_dispatcher.dispatch(new RPRequest(this, "remove", null)).getResponse();
}
catch (RPException e)
{
Throwable cause = e.getCause();
if (cause instanceof DownloadException)
throw (DownloadException)cause;
if (cause instanceof DownloadRemovalVetoException)
throw (DownloadRemovalVetoException)cause;
else
throw e;
}
}
public void remove(boolean delete_torrent, boolean delete_data)
throws DownloadException, DownloadRemovalVetoException
{
notSupported();
}
public boolean canBeRemoved()
throws DownloadRemovalVetoException
{
notSupported();
return false;
}
public DownloadAnnounceResult getLastAnnounceResult()
{
return announce_result;
}
public DownloadScrapeResult getLastScrapeResult()
{
return scrape_result;
}
public DownloadStats getStats()
{
return stats;
}
public void addListener(DownloadListener l)
{
notSupported();
}
public void removeListener(DownloadListener l)
{
notSupported();
}
public void addPropertyListener(DownloadPropertyListener l)
{
notSupported();
}
public void removePropertyListener(DownloadPropertyListener l)
{
notSupported();
}
public void addTrackerListener(DownloadTrackerListener l)
{
notSupported();
}
public void removeTrackerListener(DownloadTrackerListener l)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -