|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectqdown.quickDownloader.downloadStreamHandlers.ResumeStream
The Main ResumeStream class which downloads files which need to be resumed
| Constructor Summary | |
ResumeStream(NewDownloadControl downloadControl,
java.lang.String urlLocation,
java.lang.String saveFileTo,
java.lang.String id,
javax.swing.JProgressBar progress,
javax.swing.JTextField statusField,
NewDownloadGUI newDownload)
Constructor is used to build the class in order to resume a download |
|
| Method Summary | |
static boolean |
deletePropFileOnCompletion()
Deletes all temp files which were used by application |
boolean |
downloadTheFile(int startAt,
java.lang.String nameOfFile,
java.lang.String tempDirectory,
int totalSize)
Once the connection has been established the downloading of the file starts |
java.lang.String |
findOldResumeFile(java.lang.String fileId,
java.lang.String tempDirectory)
The method is used to find the old resume file containing the contents of the previous download |
static java.lang.String |
findPropertiesFile(java.lang.String id,
java.lang.String tempDirectory)
Searches for the properties file for the download |
int |
getSize(java.io.BufferedReader in)
Used to return the size of the download to be resumed |
int |
getTotalSize(java.io.BufferedReader in)
The method is used to return the size of the download by searching the properties file |
static boolean |
messages(java.lang.String message)
Used display messages in the system logs and application logs |
java.net.HttpURLConnection |
openConnection(int startAt)
The method is used to open a connection to the internet and to get an inputstream which will be used for the download |
static java.io.File[] |
openTempDirectory(java.lang.String tempDirectory)
Used to open the temp directory and return an array of File objects representing the contents of the directory |
boolean |
renameTempFile(java.lang.String file,
java.lang.String temp1)
Once the resume has completed the temp file is renames to the correct file name |
boolean |
setProgressBar(double value)
Sets the progress bar |
boolean |
startDownload()
The main method which initialises the download |
boolean |
writeCounter(int counter)
Method is used to write to the temp file |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ResumeStream(NewDownloadControl downloadControl,
java.lang.String urlLocation,
java.lang.String saveFileTo,
java.lang.String id,
javax.swing.JProgressBar progress,
javax.swing.JTextField statusField,
NewDownloadGUI newDownload)
downloadControl - The control classprogress - The progress barstatusField - The status fieldnewDownload - The main download GUIurlLocation - The url to be resumedsaveFileTo - The location where the url will be saved toid - The id of the resumable file| Method Detail |
public static boolean messages(java.lang.String message)
message - The message to be displayed
public boolean startDownload()
public java.lang.String findOldResumeFile(java.lang.String fileId,
java.lang.String tempDirectory)
fileId - The id used to find the previous resume filetempDirectory - The location of where the temp directory is located
public boolean renameTempFile(java.lang.String file,
java.lang.String temp1)
file - The file that will be renamed totemp1 - The name of the file to be renamed
public static boolean deletePropFileOnCompletion()
public java.net.HttpURLConnection openConnection(int startAt)
startAt - when to start a download
public int getSize(java.io.BufferedReader in)
in - An inputstream to the properties file containing the information
public int getTotalSize(java.io.BufferedReader in)
in - The Buffered Reader pointing to the properties file
public boolean downloadTheFile(int startAt,
java.lang.String nameOfFile,
java.lang.String tempDirectory,
int totalSize)
startAt - The location from the download should resume fromnameOfFile - The name of the file that the download will be renamed totempDirectory - The location of where the temp file will be saved tototalSize - The total size of the file
public boolean setProgressBar(double value)
value - The value for the progress bar
public boolean writeCounter(int counter)
counter - The size currently downloaded
public static java.lang.String findPropertiesFile(java.lang.String id,
java.lang.String tempDirectory)
id - The ID of the downloadtempDirectory - The location of the temp directory
public static java.io.File[] openTempDirectory(java.lang.String tempDirectory)
tempDirectory - The temp directory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||