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 booleanprivate booleanprivate static final intprivate booleanprivate booleanprivate booleanprivate Proxyprivate InputStreamprivate static final intprivate URLprivate Stringprivate final byte[]private longprivate StringFields inherited from class ResourceDownloaderBaseImpl
this_monFields inherited from interface 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 TypeMethodDescriptionvoidAsynchronously download.voidcancel()Cancel the download.voiddownload()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 voidlonggetSize()Attempts to get the size of the download.protected longprotected URLgetURL()private URLConnectionopenConnection(Proxy proxy, URL url) voidsetAuthenticationOutcome(String realm, URL tracker, boolean success) protected voidsetAutoPluginProxy(Map<String, Object> options) protected voidsetForceNoProxy(boolean force_no_proxy) protected voidsetForceProxy(Proxy proxy) voidsetProperty(String name, Object value) protected voidsetRequestProperties(URLConnection con, boolean use_compression) protected voidsetSize(long l) protected StringtrimForDisplay(URL url) Methods inherited from class 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:ResourceDownloaderGet a sensible name for the download based on its details (e.g. URL)- Specified by:
getNamein interfaceResourceDownloader- Returns:
-
getSize
Description copied from interface:ResourceDownloaderAttempts 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:
getSizein interfaceResourceDownloader- Throws:
ResourceDownloaderException
-
setSize
protected void setSize(long l) - Specified by:
setSizein classResourceDownloaderBaseImpl
-
setProperty
- Specified by:
setPropertyin interfaceResourceDownloader- Throws:
ResourceDownloaderException
-
getSizeSupport
- Throws:
ResourceDownloaderException
-
getClone
- Specified by:
getClonein classResourceDownloaderBaseImpl
-
asyncDownload
public void asyncDownload()Description copied from interface:ResourceDownloaderAsynchronously download.- Specified by:
asyncDownloadin interfaceResourceDownloader
-
download
Description copied from interface:ResourceDownloaderSynchronously download. Events are still reported to listeners- Specified by:
downloadin interfaceResourceDownloader- Returns:
- Throws:
ResourceDownloaderException
-
cancel
public void cancel()Description copied from interface:ResourceDownloaderCancel the download.- Specified by:
cancelin interfaceResourceDownloader
-
setRequestProperties
-
getRequestProperties
-
getAuthentication
- Specified by:
getAuthenticationin interfaceSEPasswordListener
-
setAuthenticationOutcome
- Specified by:
setAuthenticationOutcomein interfaceSEPasswordListener
-
clearPasswords
public void clearPasswords()- Specified by:
clearPasswordsin interfaceSEPasswordListener
-
openConnection
- Throws:
IOException
-
trimForDisplay
-