|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.scheisseichfindemalkeinen.pic.Pic
public class Pic
Thread which does the download This class is called Pic, because it is an shortcut for Picture. And as is started programming this program it was only for downloading pictures. But this class can not only download pictures, all kind of files can be downloaded. And no, i'm not willing to rename this class ;-)
| Field Summary | |
|---|---|
static int |
ABORTING
Download failed |
static int |
COMPLETE
Download is complete |
static int |
DOWNLOADING
Download is downloading |
static int |
FAILED
Download failed |
static int |
FAILED_FILE_NOT_EXIST
Download failed |
static int |
SLEEPING
Download is sleeping |
static java.lang.String[] |
STATUS_T
Strings for status of the download |
static int |
WAITING
Download is waiting for a free slot |
| Constructor Summary | |
|---|---|
Pic(java.lang.String urlContainer,
java.lang.String targetFilename,
java.lang.String targetPath)
Constructor |
|
| Method Summary | |
|---|---|
void |
addPicListener(IPicListener listener)
Adds a listener |
static java.util.regex.Pattern |
compileContentDispositionFilenamePattern()
This method compiles the pattern for the filename in content-disposition |
static java.lang.String |
createDirectory(java.io.File dir,
java.lang.String targetPath)
Creates a directory If there is already a file of the same name, a number is added at the end of the foldername. |
boolean |
downloadAllowed()
Allows a Pic to start the download The Pic should then return true, if it has really started the pic or false if not. |
java.lang.String |
getContainerURL()
Returns the Container-URL |
java.lang.String |
getErrMsg()
Returns the Error-Message |
int |
getFailedCount()
Returns the count of failures |
long |
getLastModified()
Returns the timestamp of last modification of the file |
long |
getSize()
Returns the filesize |
int |
getStatus()
Returns the status Available states: Pic.SLEEPING Pic.WAITING Pic.DOWNLOADING Pic.COMPLETE Pic.FAILED Pic.FAILED_FILE_NOT_EXIST |
java.lang.String |
getStatusText()
Returns the status-text for the actual status of the download |
java.lang.String |
getTarget()
Returns path and filename Note: There is no set method for this, because path and filename are hold seperated in the class. |
java.lang.String |
getTargetFilename()
Returns the filename |
java.lang.String |
getTargetPath()
Returns the path |
java.lang.String |
getThreadURL()
Returns the ThreadURL (Referrer) |
java.lang.String |
getThumb()
Returns the Thumbnail-URL |
boolean |
isDeactivated()
Returns if the download is deactivated or not |
boolean |
isFixedLastModified()
Returns if lastModified is fixed or not |
boolean |
isFixedTargetFilename()
Returns if the filename is fixed or not |
boolean |
isRenameWithContentDisposition()
Returns the renameWithContentDisposition |
static java.io.File |
moveFile(java.io.File fileToMove,
java.io.File newPath)
This method moves a file. |
static java.io.File |
moveFileToSubdir(java.lang.String filename,
java.lang.String path,
java.lang.String subdirName)
BilderHerunterlader provides options, where the user can set, that files of a specific size-range should be moved to a specific subdirectory. |
void |
progressBarChanged(long val,
java.lang.String s)
This method fires the progressBarChanged-Method on all listeners |
void |
removeAllListener()
Removes all listeners |
void |
removePicListener(IPicListener listener)
Removes a listener |
void |
run()
|
void |
setDeactivated(boolean deactivated)
Sets the download to be deactivated or not This method fires deactivatedChange-Method on all listeners and updates the object in the database. |
void |
setFixedLastModified(boolean fixedLastModified)
Sets the last modified timestamp to be fixed. |
void |
setFixedTargetFilename(boolean fixedTargetFilename)
Sets the filename to be fixed. |
void |
setLastModified(long lastModified)
Set the timestamp of last modification of the file |
void |
setRecalcutateRate(boolean recalcutateRate)
Sets the recalculate flag to true or false. |
void |
setRenameWithContentDisposition(boolean renameWithContentDisposition)
Sets the renameWithContentDisposition |
void |
setStatus(int status)
Attention: You should not use the method from other classes. |
void |
setTargetFilename(java.lang.String targetFilename)
Sets the filename If the filename was set to be fixed before and the argument for targetFilename is here an empty string, the filename is set to be not fixed anymore. |
void |
setTargetPath(java.lang.String targetPath)
Sets the Path |
void |
setThreadURL(java.lang.String threadURL)
Set the threadURL (Referrer) |
void |
setThumb(java.lang.String thumb)
Set the Thumbnail-URL |
void |
startDownload()
Start the download |
void |
stopDownload()
Stop the download This does not immediately stop the download, it only changes the stop-flag to true and the download method will stop if this flag is true. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SLEEPING
public static final int WAITING
public static final int DOWNLOADING
public static final int COMPLETE
public static final int FAILED
public static final int ABORTING
public static final int FAILED_FILE_NOT_EXIST
public static final java.lang.String[] STATUS_T
| Constructor Detail |
|---|
public Pic(java.lang.String urlContainer,
java.lang.String targetFilename,
java.lang.String targetPath)
urlContainer - Container-URLtargetFilename - FilenametargetPath - Target path| Method Detail |
|---|
public void startDownload()
public void stopDownload()
public void run()
run in interface java.lang.Runnable
public void progressBarChanged(long val,
java.lang.String s)
val - Values - Progressbar-Textpublic void addPicListener(IPicListener listener)
listener - Listenerpublic void removePicListener(IPicListener listener)
listener - Listenerpublic void removeAllListener()
public boolean downloadAllowed()
IDownloadListener
downloadAllowed in interface IDownloadListener
public static java.lang.String createDirectory(java.io.File dir,
java.lang.String targetPath)
dir - DirectorytargetPath - Path
public static java.io.File moveFileToSubdir(java.lang.String filename,
java.lang.String path,
java.lang.String subdirName)
filename - Filenamepath - PathsubdirName - Name of the subdir
createDirectory(File, String)
public static java.io.File moveFile(java.io.File fileToMove,
java.io.File newPath)
fileToMove - FilenamenewPath - Path
createDirectory(File, String)public static java.util.regex.Pattern compileContentDispositionFilenamePattern()
public void setRecalcutateRate(boolean recalcutateRate)
recalcutateRate - Recalculate flagCalculateRateTimerTaskpublic java.lang.String getContainerURL()
getContainerURL in interface IDownloadListenerpublic java.lang.String getTarget()
public long getSize()
public java.lang.String getStatusText()
public int getStatus()
public void setStatus(int status)
status - Statuspublic long getLastModified()
public void setLastModified(long lastModified)
lastModified - Last modification timestamppublic boolean isFixedLastModified()
public void setFixedLastModified(boolean fixedLastModified)
fixedLastModified - Fixed lastModifiedpublic java.lang.String getTargetPath()
public void setTargetPath(java.lang.String targetPath)
targetPath - Pathpublic java.lang.String getTargetFilename()
public void setTargetFilename(java.lang.String targetFilename)
targetFilename - Filenamepublic java.lang.String getThumb()
public void setThumb(java.lang.String thumb)
thumb - Thumbnail-URLpublic boolean isFixedTargetFilename()
setFixedTargetFilename(boolean)public void setFixedTargetFilename(boolean fixedTargetFilename)
fixedTargetFilename - Fixed filenamepublic java.lang.String getThreadURL()
public void setThreadURL(java.lang.String threadURL)
threadURL - ThreadURL (Referrer)public int getFailedCount()
public boolean isDeactivated()
public void setDeactivated(boolean deactivated)
deactivated - Deactivatedpublic java.lang.String getErrMsg()
public boolean isRenameWithContentDisposition()
public void setRenameWithContentDisposition(boolean renameWithContentDisposition)
renameWithContentDisposition - renameWithContentDisposition
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||