FileDocCategorySizeDatePackage
ResourceDownloaderDelayedImpl.javaAPI DocAzureus 3.0.3.43508Thu Feb 09 19:42:50 GMT 2006org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader

ResourceDownloaderDelayedImpl

public class ResourceDownloaderDelayedImpl extends ResourceDownloaderBaseImpl
author
parg

Fields Summary
protected ResourceDownloaderDelayedFactory
factory
protected ResourceDownloaderBaseImpl
delegate
protected long
size
Constructors Summary
protected ResourceDownloaderDelayedImpl(ResourceDownloaderBaseImpl _parent, ResourceDownloaderDelayedFactory _factory)

	
	
	
						
				 
	
		super( _parent );
		
		factory	= _factory;
	
Methods Summary
public voidaddListener(ResourceDownloaderListener l)

		getDelegate();
		
		delegate.addListener(l);	
	
public voidasyncDownload()

		getDelegate();
		
		delegate.asyncDownload();	
	
public voidcancel()

		setCancelled();
		
		getDelegate();
		
		delegate.cancel();		
	
public java.io.InputStreamdownload()

		getDelegate();
		
		return( delegate.download());	
	
public ResourceDownloaderBaseImplgetClone(ResourceDownloaderBaseImpl parent)

		
		ResourceDownloaderDelayedImpl	c = new ResourceDownloaderDelayedImpl( parent, factory );
		
		c.setSize( size );
		
		c.setProperties( this );

		return( c );
	
protected voidgetDelegate()

		try{
			this_mon.enter();
		
			if ( delegate == null ){
				
				try{
					delegate	= (ResourceDownloaderBaseImpl)factory.create();
					
					delegate.setParent( this );
	
					if ( size >= 0 ){
						
						delegate.setSize( size );
					}
					
				}catch(  ResourceDownloaderException e ){
					
					delegate = new ResourceDownloaderErrorImpl( this, e );
				}
			}
		}finally{
			
			this_mon.exit();
		}
	
public java.lang.StringgetName()

		if ( delegate == null ){
			
			return( "<...>" );
		}
		
		return( delegate.getName());
	
public longgetSize()

	
		getDelegate();
		
		return( delegate.getSize());	
	
public voidremoveListener(ResourceDownloaderListener l)

		getDelegate();
		
		delegate.removeListener(l);		
	
public voidreportActivity(java.lang.String activity)

		getDelegate();
		
		delegate.reportActivity( activity );		
	
protected voidsetProperty(java.lang.String name, java.lang.Object value)

		setPropertySupport( name, value );
		
		if ( delegate != null ){
			
			delegate.setProperty( name, value );
		}
	
protected voidsetSize(long _size)

		size	= _size;
		
		if ( delegate != null && size >= 0){
					
			delegate.setSize( size );
		}