FileDocCategorySizeDatePackage
RPTorrentDownloader.javaAPI DocAzureus 3.0.3.43327Tue Jul 27 15:05:24 BST 2004org.gudy.azureus2.pluginsimpl.remote.torrent

RPTorrentDownloader

public class RPTorrentDownloader extends RPObject implements TorrentDownloader
author
parg

Fields Summary
protected transient TorrentDownloader
delegate
Constructors Summary
protected RPTorrentDownloader(TorrentDownloader _delegate)

		super( _delegate );
	
Methods Summary
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 ));
	
protected void_setDelegate(java.lang.Object _delegate)

		delegate = (TorrentDownloader)_delegate;
	
public java.lang.Object_setLocal()

		return( _fixupLocal());
	
public static org.gudy.azureus2.pluginsimpl.remote.torrent.RPTorrentDownloadercreate(TorrentDownloader _delegate)

		RPTorrentDownloader	res =(RPTorrentDownloader)_lookupLocal( _delegate );
		
		if ( res == null ){
			
			res = new RPTorrentDownloader( _delegate );
		}
		
		return( res );
	
public Torrentdownload()

		try{
			RPTorrent resp = (RPTorrent)_dispatcher.dispatch( new RPRequest( this, "download", null )).getResponse();
			
			resp._setRemote( _dispatcher );
			
			return( resp );
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof TorrentException ){
				
				throw((TorrentException)e.getCause());
			}
			
			throw( e );
		}	
	
public Torrentdownload(java.lang.String encoding)

		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 );
		}