org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader
Class ResourceDownloaderURLImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
      extended by org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderURLImpl
All Implemented Interfaces:
SEPasswordListener, ResourceDownloader

public class ResourceDownloaderURLImpl
extends ResourceDownloaderBaseImpl
implements SEPasswordListener


Field Summary
 
Fields inherited from class org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
this_mon
 
Fields inherited from interface org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader
PR_STRING_CONTENT_TYPE
 
Constructor Summary
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, URL _url)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, URL _url, boolean _auth_supplied, String _user_name, String _password)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, URL _url, byte[] _data, boolean _auth_supplied, String _user_name, String _password)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, URL _url, String _user_name, String _password)
           
 
Method Summary
 void asyncDownload()
          Asynchronously download.
 void cancel()
          Cancel the download.
 void clearPasswords()
           
 InputStream download()
          Synchronously download.
 PasswordAuthentication getAuthentication(String realm, URL tracker)
           
 ResourceDownloaderBaseImpl getClone(ResourceDownloaderBaseImpl parent)
           
 String getName()
          Get a sensible name for the download based on its details (e.g.
protected  void getRequestProperties(URLConnection con)
           
 long getSize()
          Attempts to get the size of the download.
protected  long getSizeSupport()
           
protected  URL getURL()
           
 void setAuthenticationOutcome(String realm, URL tracker, boolean success)
           
protected  void setAutoPluginProxy()
           
protected  void setForceNoProxy(boolean force_no_proxy)
           
protected  void setForceProxy(Proxy proxy)
           
 void setProperty(String name, Object value)
           
protected  void setRequestProperties(URLConnection con, boolean use_compression)
           
protected  void setSize(long l)
           
protected  String trimForDisplay(URL url)
           
 
Methods inherited from class org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
addChild, addListener, addReportListener, getBooleanProperty, getChildren, getClone, getLCKeyProperties, getLogIndent, getLongProperty, getParent, getProperty, getPropertySupport, getStringProperty, getStringPropertySupport, informActivity, informAmountComplete, informComplete, informFailed, informPercentDone, isCancelled, removeChild, removeListener, reportActivity, reportActivity, reportAmountComplete, reportPercentComplete, setCancelled, setParent, setProperties, setPropertiesSet, setPropertySupport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 URL _url)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 URL _url,
                                 String _user_name,
                                 String _password)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 URL _url,
                                 boolean _auth_supplied,
                                 String _user_name,
                                 String _password)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 URL _url,
                                 byte[] _data,
                                 boolean _auth_supplied,
                                 String _user_name,
                                 String _password)
Parameters:
_parent -
_url -
_data - if null, GET will be used, otherwise POST will be used with the data supplied
_auth_supplied -
_user_name -
_password -
Method Detail

setForceNoProxy

protected void setForceNoProxy(boolean force_no_proxy)

setForceProxy

protected void setForceProxy(Proxy proxy)

setAutoPluginProxy

protected void setAutoPluginProxy()

getURL

protected URL getURL()

getName

public String getName()
Description copied from interface: ResourceDownloader
Get a sensible name for the download based on its details (e.g. URL)

Specified by:
getName in interface ResourceDownloader
Returns:

getSize

public long getSize()
             throws ResourceDownloaderException
Description copied from interface: ResourceDownloader
Attempts to get the size of the download. Returns -1 if the size can't be determined.

Note: You must not call this method from the reportActivity callback method.

Specified by:
getSize in interface ResourceDownloader
Throws:
ResourceDownloaderException

setSize

protected void setSize(long l)
Specified by:
setSize in class ResourceDownloaderBaseImpl

setProperty

public void setProperty(String name,
                        Object value)
                 throws ResourceDownloaderException
Specified by:
setProperty in interface ResourceDownloader
Throws:
ResourceDownloaderException

getSizeSupport

protected long getSizeSupport()
                       throws ResourceDownloaderException
Throws:
ResourceDownloaderException

getClone

public ResourceDownloaderBaseImpl getClone(ResourceDownloaderBaseImpl parent)
Specified by:
getClone in class ResourceDownloaderBaseImpl

asyncDownload

public void asyncDownload()
Description copied from interface: ResourceDownloader
Asynchronously download.

Specified by:
asyncDownload in interface ResourceDownloader

download

public InputStream download()
                     throws ResourceDownloaderException
Description copied from interface: ResourceDownloader
Synchronously download. Events are still reported to listeners

Specified by:
download in interface ResourceDownloader
Returns:
Throws:
ResourceDownloaderException

cancel

public void cancel()
Description copied from interface: ResourceDownloader
Cancel the download.

Specified by:
cancel in interface ResourceDownloader

setRequestProperties

protected void setRequestProperties(URLConnection con,
                                    boolean use_compression)

getRequestProperties

protected void getRequestProperties(URLConnection con)

getAuthentication

public PasswordAuthentication getAuthentication(String realm,
                                                URL tracker)
Specified by:
getAuthentication in interface SEPasswordListener

setAuthenticationOutcome

public void setAuthenticationOutcome(String realm,
                                     URL tracker,
                                     boolean success)
Specified by:
setAuthenticationOutcome in interface SEPasswordListener

clearPasswords

public void clearPasswords()
Specified by:
clearPasswords in interface SEPasswordListener

trimForDisplay

protected String trimForDisplay(URL url)