|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.aq.webdownload.Downloader
de.aitools.aq.webdownload.WgetDownloader
public class WgetDownloader
Downloader implementation that wraps the wget command. CAUTION: using multiple downloaders in parallel threads eventually causes IOExceptions (too many open connections) while trying to create the process to wrap wget. This occurs because the garbage collection is not fast enough to recycle all process objects. A workaround is to call the garbage collector manually after every n downloads. (A test using 10 parallel downloaders and calling gc every 1000 downloads worked fine.)
Constructor Summary | |
---|---|
WgetDownloader()
|
|
WgetDownloader(java.lang.String[] params)
|
Method Summary | |
---|---|
java.io.File |
load(java.lang.String url)
Loads the data designated by url and creates and returns a
file object which can be used to access the data. |
java.io.File |
load(java.lang.String url,
java.io.File dir)
Loads the data designated by url to the directory designated
by dir . |
java.io.File |
load(java.net.URL url)
Loads the data designated by url and creates and returns a
file object which can be used to access the data. |
java.io.File |
load(java.net.URL url,
java.io.File dir)
Loads the data designated by url to the directory designated
by dir . |
Methods inherited from class de.aitools.aq.webdownload.Downloader |
---|
getContentType, getContentType, getHeaders, getReadTimeout, getTempFilePrefix, getTempFileSuffix, setConnectionTimeout, setConnectionTimeout, setReadTimeout, setTempFilePrefix, setTempFileSuffix |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WgetDownloader()
public WgetDownloader(java.lang.String[] params)
Method Detail |
---|
public java.io.File load(java.net.URL url) throws DownloaderException
url
and creates and returns a
file object which can be used to access the data. The returned file object represents a temporary file
located in the default temp directory.
CAUTION: The file designated by the returned file object will be deleted automatically at a normal JVM exit.
load
in class Downloader
url
- The resource to download
DownloaderException
public java.io.File load(java.lang.String url) throws DownloaderException
url
and creates and returns a
file object which can be used to access the data. The returned file object represents a temporary file
located in the default temp directory.
CAUTION: The file designated by the returned file object will be deleted automatically at a normal JVM exit.
load
in class Downloader
url
- The resource to download
DownloaderException
public java.io.File load(java.net.URL url, java.io.File dir) throws DownloaderException
url
to the directory designated
by dir
. A file is created in dir
and will be
returned to provide access to the downloaded data.
Note that the provided dir
must denote a directory and this
directory must be writable.
CAUTION: The returned file object represents a temporary file
located in the directory designated by dir
. This file will
NOT be deleted automatically, so you have to care for your disk
space yourself.
load
in class Downloader
url
- The resource to downloaddir
- The directory where the downloaded data should be stored
DownloaderException
public java.io.File load(java.lang.String url, java.io.File dir) throws DownloaderException
url
to the directory designated
by dir
. A file is created in dir
and will be
returned to provide access to the downloaded data.
Note that the provided dir
must denote a directory and this
directory must be writable.
CAUTION: The returned file object represents a temporary file
located in the directory designated by dir
. This file will
NOT be deleted automatically, so you have to care for your disk
space yourself.
load
in class Downloader
url
- The resource to downloaddir
- The directory where the downloaded data should be stored
DownloaderException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |