|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectecologylab.generic.Debug
ecologylab.io.ZipDownload
public class ZipDownload
Class implementing DownloadLoadable to allow for the downloading and writing to disk of zip files. Additionally files can be extracted after downloaded.
| Constructor Summary | |
|---|---|
ZipDownload(ParsedURL zipSource,
java.io.File zipTarget)
|
|
ZipDownload(ParsedURL zipSource,
java.io.File zipTarget,
StatusReporter status)
|
|
| Method Summary | |
|---|---|
void |
delivery(java.lang.Object o)
Called, probably later asynchronously, when the requested service is complete. |
static ZipDownload |
downloadAndPerhapsUncompress(ParsedURL sourceZip,
java.io.File targetDir,
StatusReporter status,
boolean unCompress)
Convenience function to allow downloading and uncompressing of a zip file from a source to a target location with minimal effort. |
void |
downloadAndWrite()
|
void |
downloadAndWrite(boolean extractWhenComplete)
Initiate the download and writing of the zip file. |
void |
downloadDone()
Call to notify the object that its download is completed; |
static void |
extractZipFile(java.io.File zipSource)
|
static void |
extractZipFile(java.io.File zipSource,
java.io.File unzipPath)
Extracts a zip file into the directory where it resides |
static void |
extractZipFile(java.lang.String zipSourcePath)
Extracts a zip file into the directory where it resides |
static void |
extractZipFile(java.lang.String zipSourcePath,
java.io.File unzipPath)
Extracts a zip file into the directory where it resides |
java.io.BufferedInputStream |
getInputStream(java.io.File zipTarget)
|
void |
handleIoError()
Called in case an IO error happens. |
boolean |
handleTimeout()
Called in case a timeout happens. |
boolean |
isDownloadDone()
Called to inquire on the status of a download. |
boolean |
isRecycled()
True if the Downloadable has been recycled, and thus should not be downloaded. |
void |
performDownload()
ONLY called by DownloadProcessors to actually download the
zip file! Not called by outsiders! |
static void |
setDownloadProcessor(DownloadProcessor downloadProcessor)
|
static void |
stopDownloadProcessor()
|
void |
waitForDownload()
|
| Methods inherited from class ecologylab.generic.Debug |
|---|
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ZipDownload(ParsedURL zipSource,
java.io.File zipTarget,
StatusReporter status)
public ZipDownload(ParsedURL zipSource,
java.io.File zipTarget)
| Method Detail |
|---|
public void downloadAndWrite(boolean extractWhenComplete)
public static void stopDownloadProcessor()
public void downloadAndWrite()
public void performDownload()
throws java.lang.Exception
DownloadProcessors to actually download the
zip file! Not called by outsiders!
performDownload in interface Downloadablejava.lang.Exception
public java.io.BufferedInputStream getInputStream(java.io.File zipTarget)
throws java.lang.Exception
java.lang.Exceptionpublic boolean isDownloadDone()
Downloadable
isDownloadDone in interface Downloadablepublic boolean handleTimeout()
Downloadable
handleTimeout in interface Downloadablepublic void handleIoError()
Downloadable
handleIoError in interface Downloadablepublic void delivery(java.lang.Object o)
DispatchTarget
delivery in interface DispatchTargeto - -- enables an argument of any type to be passed back.
public static ZipDownload downloadAndPerhapsUncompress(ParsedURL sourceZip,
java.io.File targetDir,
StatusReporter status,
boolean unCompress)
sourceZip - The location of the zip file to download and uncompress.targetDir - The location where the zip file should be uncompressed. This
directory structure will be created if it doesn't exist.status - The StatusReporter object that provides a source of state change visiblity;
can be null.unCompress - true if the file is a zip that needs to be uncompressed after download.
public static void extractZipFile(java.lang.String zipSourcePath)
throws java.io.IOException
zipSourcePath - The path to the source zip file to extract.
java.io.IOException
public static void extractZipFile(java.io.File zipSource)
throws java.io.IOException
java.io.IOException
public static void extractZipFile(java.lang.String zipSourcePath,
java.io.File unzipPath)
throws java.io.IOException
zipSourcePath - The source zip file to extract
java.io.IOException
public static void extractZipFile(java.io.File zipSource,
java.io.File unzipPath)
throws java.io.IOException
zipSource - The source zip file to extract
java.io.IOExceptionpublic void downloadDone()
downloadDone in interface Downloadablepublic void waitForDownload()
public static void setDownloadProcessor(DownloadProcessor downloadProcessor)
public boolean isRecycled()
Downloadable
isRecycled in interface Downloadable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||