Class ResourceDownloaderURLImpl
java.lang.Object
com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderURLImpl
- All Implemented Interfaces:
SEPasswordListener
,ResourceDownloader
public class ResourceDownloaderURLImpl
extends ResourceDownloaderBaseImpl
implements SEPasswordListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private static final int
private boolean
private boolean
private boolean
private Proxy
private InputStream
private static final int
private URL
private String
private final byte[]
private long
private String
Fields inherited from class com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
this_mon
Fields inherited from interface com.biglybt.pif.utils.resourcedownloader.ResourceDownloader
PR_BOOLEAN_ANONYMOUS, PR_STRING_CONTENT_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionResourceDownloaderURLImpl
(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
Modifier and TypeMethodDescriptionvoid
Asynchronously download.void
cancel()
Cancel the download.void
download()
Synchronously download.getAuthentication
(String realm, URL tracker) getClone
(ResourceDownloaderBaseImpl parent) getName()
Get a sensible name for the download based on its details (e.g.protected void
long
getSize()
Attempts to get the size of the download.protected long
protected URL
getURL()
private URLConnection
openConnection
(Proxy proxy, URL url) void
setAuthenticationOutcome
(String realm, URL tracker, boolean success) protected void
setAutoPluginProxy
(Map<String, Object> options) 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 com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
addChild, addListener, addReportListener, getBooleanProperty, getBooleanProperty, getChildren, getClone, getLCKeyProperties, getLogIndent, getLongProperty, getParent, getProperty, getProperty, getPropertySupport, getStringProperty, getStringPropertySupport, informActivity, informAmountComplete, informComplete, informFailed, informPercentDone, isAnonymous, isCancelled, removeChild, removeListener, reportActivity, reportActivity, reportAmountComplete, reportPercentComplete, setCancelled, setParent, setProperties, setPropertiesSet, setPropertyRecursive, setPropertySupport
-
Field Details
-
BUFFER_SIZE
private static final int BUFFER_SIZE- See Also:
-
MAX_IN_MEM_READ_SIZE
private static final int MAX_IN_MEM_READ_SIZE- See Also:
-
original_url
-
auth_supplied
private boolean auth_supplied -
user_name
-
password
-
input_stream
-
cancel_download
private boolean cancel_download -
download_initiated
private boolean download_initiated -
size
private long size -
force_no_proxy
private boolean force_no_proxy -
force_proxy
-
auto_plugin_proxy
private boolean auto_plugin_proxy -
auto_plugin_proxy_options
-
post_data
private final byte[] post_data
-
-
Constructor Details
-
ResourceDownloaderURLImpl
-
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 Details
-
setForceNoProxy
protected void setForceNoProxy(boolean force_no_proxy) -
setForceProxy
-
setAutoPluginProxy
-
getURL
-
getName
Description copied from interface:ResourceDownloader
Get a sensible name for the download based on its details (e.g. URL)- Specified by:
getName
in interfaceResourceDownloader
- Returns:
-
getSize
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 interfaceResourceDownloader
- Throws:
ResourceDownloaderException
-
setSize
protected void setSize(long l) - Specified by:
setSize
in classResourceDownloaderBaseImpl
-
setProperty
- Specified by:
setProperty
in interfaceResourceDownloader
- Throws:
ResourceDownloaderException
-
getSizeSupport
- Throws:
ResourceDownloaderException
-
getClone
- Specified by:
getClone
in classResourceDownloaderBaseImpl
-
asyncDownload
public void asyncDownload()Description copied from interface:ResourceDownloader
Asynchronously download.- Specified by:
asyncDownload
in interfaceResourceDownloader
-
download
Description copied from interface:ResourceDownloader
Synchronously download. Events are still reported to listeners- Specified by:
download
in interfaceResourceDownloader
- Returns:
- Throws:
ResourceDownloaderException
-
cancel
public void cancel()Description copied from interface:ResourceDownloader
Cancel the download.- Specified by:
cancel
in interfaceResourceDownloader
-
setRequestProperties
-
getRequestProperties
-
getAuthentication
- Specified by:
getAuthentication
in interfaceSEPasswordListener
-
setAuthenticationOutcome
- Specified by:
setAuthenticationOutcome
in interfaceSEPasswordListener
-
clearPasswords
public void clearPasswords()- Specified by:
clearPasswords
in interfaceSEPasswordListener
-
openConnection
- Throws:
IOException
-
trimForDisplay
-