|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.download.DownloadConnection
public class DownloadConnection
A download connection offers a connection to a set url, opens a stream and loads the content into a stream.
| Nested Class Summary | |
|---|---|
static interface |
DownloadConnection.DownloadMonitor
|
| Constructor Summary | |
|---|---|
DownloadConnection()
|
|
| Method Summary | |
|---|---|
void |
abortDownload()
Interrupts and cancels the current download immediately. |
DownloadConnection |
download()
Loads the content from the set url source. |
DownloadConnection |
download(URL url)
Loads the content from a given url source. |
String |
getAuthenticationPassword()
|
String |
getAuthenticationUser()
|
byte[] |
getContentAsBytes()
Returns the loaded content in a byte[]. |
String |
getContentAsString()
Returns the content as a String encoded by the determined content encoding. |
long |
getContentCurrentSize()
Returns the current size of the loaded amount of content. |
String |
getContentEncoding()
|
long |
getContentEstimatedSize()
Returns the size that was estimated to receive, by the http content size determined. |
long |
getContentSize()
Returns the current size of the downloaded content. |
String |
getContentType()
|
DownloadManager |
getDownloadManager()
|
long |
getDownloadSpeed()
|
int |
getHTTPStatusCode()
|
String |
getStandardEncoding()
|
long |
getTimeExpired()
|
URL |
getUrl()
|
String |
getUsedStringEncoding()
|
boolean |
isAlive()
If the download is initiated in threaded mode, this indicates if the current download thread is still active. |
boolean |
isDownloadSuccessful()
Returns true, if no error has occurred during the download. |
int |
processStatePercentage()
Returns the percentage of the currently loaded bytes towards the estimated bytes to load. |
void |
run()
|
boolean |
saveContentToFile(File file)
Saves the content into the given file. |
void |
setAuthenticationPassword(String authenticationPassword)
|
void |
setAuthenticationUser(String authenticationUser)
|
void |
setContentEncoding(String contentEncoding)
|
void |
setContentType(String contentType)
|
void |
setDownloadManager(DownloadManager downloadManager)
|
DownloadConnection |
setDownloadMonitor(DownloadConnection.DownloadMonitor downloadMonitor)
|
void |
setStandardEncoding(String standardEncoding)
|
DownloadConnection |
setUrl(URL url)
|
void |
setUsedStringEncoding(String usedStringEncoding)
|
DownloadConnection |
threadedDownload()
Downloads the set url source through a single thread created. |
DownloadConnection |
threadedDownload(URL url)
Downloads the given url through a single thread created for this purpose. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DownloadConnection()
| Method Detail |
|---|
public DownloadConnection setUrl(URL url)
public void run()
run in interface Runnablepublic DownloadConnection threadedDownload()
public DownloadConnection threadedDownload(URL url)
url -
public void abortDownload()
public boolean isAlive()
public int processStatePercentage()
public DownloadConnection download(URL url)
url - public DownloadConnection download()
public int getHTTPStatusCode()
public byte[] getContentAsBytes()
public String getContentAsString()
public boolean isDownloadSuccessful()
public boolean saveContentToFile(File file)
file - public long getContentEstimatedSize()
public long getContentCurrentSize()
public long getContentSize()
public String getAuthenticationUser()
public void setAuthenticationUser(String authenticationUser)
public String getAuthenticationPassword()
public void setAuthenticationPassword(String authenticationPassword)
public DownloadManager getDownloadManager()
public void setDownloadManager(DownloadManager downloadManager)
public String getContentEncoding()
public void setContentEncoding(String contentEncoding)
public String getContentType()
public void setContentType(String contentType)
public long getTimeExpired()
public long getDownloadSpeed()
public String getStandardEncoding()
public void setStandardEncoding(String standardEncoding)
public String getUsedStringEncoding()
public void setUsedStringEncoding(String usedStringEncoding)
public URL getUrl()
public DownloadConnection setDownloadMonitor(DownloadConnection.DownloadMonitor downloadMonitor)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||