Methods Summary |
---|
protected void | addChild(org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl kid)
children.add( kid );
|
public void | addListener(ResourceDownloaderListener l)
listeners.add( l );
if ( result_informed ){
if (result_informed_data instanceof InputStream ){
l.completed( this, (InputStream)result_informed_data);
}else{
l.failed( this, (ResourceDownloaderException)result_informed_data);
}
}
|
protected void | addReportListener(ResourceDownloader rd)
rd.addListener(
new ResourceDownloaderAdapter()
{
public void
reportActivity(
ResourceDownloader downloader,
String activity )
{
informActivity( activity );
}
public void
failed(
ResourceDownloader downloader,
ResourceDownloaderException e )
{
informActivity( downloader.getName() + ":" + e.getMessage());
}
});
|
protected java.util.List | getChildren()
return( children );
|
public abstract org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl | getClone(org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl _parent)
|
protected java.lang.String | getLogIndent()
String indent = "";
ResourceDownloaderBaseImpl pos = parent;
while( pos != null ){
indent += " ";
pos = pos.getParent();
}
return( indent );
|
protected org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl | getParent()
return( parent );
|
public java.lang.Object | getProperty(java.lang.String name)
// hack this, properties are read during size acquisition - should treat size as a property
// too....
getSize();
return( properties.get( name ));
|
protected void | informActivity(java.lang.String activity)
for (int i=0;i<listeners.size();i++){
try{
((ResourceDownloaderListener)listeners.get(i)).reportActivity(this,activity);
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
|
protected void | informAmountComplete(long amount)
for (int i=0;i<listeners.size();i++){
try{
((ResourceDownloaderListener)listeners.get(i)).reportAmountComplete(this,amount);
}catch( NoSuchMethodError e ){
// handle addition of this new method with old impls
}catch( AbstractMethodError e ){
// handle addition of this new method with old impls
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
|
protected boolean | informComplete(java.io.InputStream is)
if ( !result_informed ){
for (int i=0;i<listeners.size();i++){
try{
if ( !((ResourceDownloaderListener)listeners.get(i)).completed(this,is)){
return( false );
}
}catch( Throwable e ){
Debug.printStackTrace(e);
return( false );
}
}
result_informed = true;
result_informed_data = is;
}
return( true );
|
protected void | informFailed(ResourceDownloaderException e)
if ( !result_informed ){
result_informed = true;
result_informed_data = e;
for (int i=0;i<listeners.size();i++){
try{
((ResourceDownloaderListener)listeners.get(i)).failed(this,e);
}catch( Throwable f ){
Debug.printStackTrace(f);
}
}
}
|
protected void | informPercentDone(int percentage)
for (int i=0;i<listeners.size();i++){
try{
((ResourceDownloaderListener)listeners.get(i)).reportPercentComplete(this,percentage);
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
|
public boolean | isCancelled()
return( download_cancelled );
|
protected void | removeChild(org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl kid)
children.remove( kid );
|
public void | removeListener(ResourceDownloaderListener l)
listeners.remove(l);
|
public void | reportActivity(java.lang.String str)
informActivity( str );
|
public void | reportActivity(ResourceDownloader downloader, java.lang.String activity)
informActivity( activity );
|
public void | reportAmountComplete(ResourceDownloader downloader, long amount)
informAmountComplete( amount );
|
public void | reportPercentComplete(ResourceDownloader downloader, int percentage)
informPercentDone( percentage );
|
protected void | setCancelled()
download_cancelled = true;
|
protected void | setParent(ResourceDownloader _parent)
ResourceDownloaderBaseImpl old_parent = parent;
parent = (ResourceDownloaderBaseImpl)_parent;
if( old_parent != null ){
old_parent.removeChild( this );
}
if ( parent != null ){
parent.addChild( this );
}
|
protected void | setProperties(org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl other)
Map p = other.properties;
Iterator it = p.keySet().iterator();
while( it.hasNext()){
String key = (String)it.next();
setProperty( key, p.get(key));
}
|
protected abstract void | setProperty(java.lang.String name, java.lang.Object value)
|
protected void | setPropertySupport(java.lang.String name, java.lang.Object value)
properties.put( name, value );
|
protected abstract void | setSize(long size)
|