use of com.biglybt.pifimpl.remote.RPException in project BiglyBT by BiglySoftware.
the class RPTorrentDownloader method download.
@Override
public Torrent download(String encoding) throws TorrentException {
try {
RPTorrent resp = (RPTorrent) _dispatcher.dispatch(new RPRequest(this, "download[String]", new Object[] { encoding })).getResponse();
resp._setRemote(_dispatcher);
return (resp);
} catch (RPException e) {
if (e.getCause() instanceof TorrentException) {
throw ((TorrentException) e.getCause());
}
throw (e);
}
}
use of com.biglybt.pifimpl.remote.RPException in project BiglyBT by BiglySoftware.
the class RPTorrentDownloader method _process.
@Override
public RPReply _process(RPRequest request) {
String method = request.getMethod();
if (method.equals("download")) {
try {
Torrent to = delegate.download();
RPTorrent res = RPTorrent.create(to);
return (new RPReply(res));
} catch (TorrentException e) {
return (new RPReply(e));
}
} else if (method.equals("download[String]")) {
try {
Torrent to = delegate.download((String) request.getParams()[0]);
RPTorrent res = RPTorrent.create(to);
return (new RPReply(res));
} catch (TorrentException e) {
return (new RPReply(e));
}
}
throw (new RPException("Unknown method: " + method));
}
use of com.biglybt.pifimpl.remote.RPException in project BiglyBT by BiglySoftware.
the class RPTorrentManager method getURLDownloader.
@Override
public TorrentDownloader getURLDownloader(URL url, String user_name, String password) throws TorrentException {
try {
RPTorrentDownloader resp = (RPTorrentDownloader) _dispatcher.dispatch(new RPRequest(this, "getURLDownloader[URL,String,String]", new Object[] { url, user_name, password })).getResponse();
resp._setRemote(_dispatcher);
return (resp);
} catch (RPException e) {
if (e.getCause() instanceof TorrentException) {
throw ((TorrentException) e.getCause());
}
throw (e);
}
}
use of com.biglybt.pifimpl.remote.RPException in project BiglyBT by BiglySoftware.
the class RPTorrentManager method createFromBEncodedData.
@Override
public Torrent createFromBEncodedData(byte[] data) throws TorrentException {
try {
RPTorrent res = (RPTorrent) _dispatcher.dispatch(new RPRequest(this, "createFromBEncodedData[byte[]]", new Object[] { data })).getResponse();
res._setRemote(_dispatcher);
return (res);
} catch (RPException e) {
if (e.getCause() instanceof TorrentException) {
throw ((TorrentException) e.getCause());
}
throw (e);
}
}
use of com.biglybt.pifimpl.remote.RPException in project BiglyBT by BiglySoftware.
the class RPTorrentManager method _process.
@Override
public RPReply _process(RPRequest request) {
String method = request.getMethod();
Object[] params = request.getParams();
if (method.equals("getURLDownloader[URL]")) {
try {
TorrentDownloader dl = delegate.getURLDownloader((URL) params[0]);
RPTorrentDownloader res = RPTorrentDownloader.create(dl);
return (new RPReply(res));
} catch (TorrentException e) {
return (new RPReply(e));
}
} else if (method.equals("getURLDownloader[URL,String,String]")) {
try {
TorrentDownloader dl = delegate.getURLDownloader((URL) params[0], (String) params[1], (String) params[2]);
RPTorrentDownloader res = RPTorrentDownloader.create(dl);
return (new RPReply(res));
} catch (TorrentException e) {
return (new RPReply(e));
}
} else if (method.equals("createFromBEncodedData[byte[]]")) {
try {
return (new RPReply(RPTorrent.create(delegate.createFromBEncodedData((byte[]) params[0]))));
} catch (TorrentException e) {
return (new RPReply(e));
}
}
throw (new RPException("Unknown method: " + method));
}
Aggregations