|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.aq.webdownload.Downloader
public abstract class Downloader
Downloader
is the abstract base class for all Downloaders.
Method Summary | |
---|---|
java.lang.String |
getContentType(java.lang.String url)
Returns the data of the Content-Type HTTP response header field for the given url or null if no such field exists. |
java.lang.String |
getContentType(java.net.URL url)
Returns the data of the Content-Type HTTP response header field for the given url or null if no such field exists. |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders(java.lang.String url)
Convenience method to detect the content type of the resource designated by url . |
int |
getReadTimeout()
|
java.lang.String |
getTempFilePrefix()
|
java.lang.String |
getTempFileSuffix()
|
abstract 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. |
abstract java.io.File |
load(java.lang.String url,
java.io.File dir)
Loads the data designated by url to the directory designated
by dir . |
abstract 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. |
abstract java.io.File |
load(java.net.URL url,
java.io.File dir)
Loads the data designated by url to the directory designated
by dir . |
int |
setConnectionTimeout()
|
void |
setConnectionTimeout(int seconds)
|
void |
setReadTimeout(int seconds)
|
void |
setTempFilePrefix(java.lang.String tempFilePrefix)
|
void |
setTempFileSuffix(java.lang.String tempFileSuffix)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public abstract 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.
url
- The resource to download
DownloaderException
public abstract 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.
url
- The resource to download
DownloaderException
public abstract 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.
url
- The resource to downloaddir
- The directory where the downloaded data should be stored
DownloaderException
public abstract 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.
url
- The resource to downloaddir
- The directory where the downloaded data should be stored
DownloaderException
public void setConnectionTimeout(int seconds)
public int setConnectionTimeout()
public void setReadTimeout(int seconds)
public int getReadTimeout()
public void setTempFilePrefix(java.lang.String tempFilePrefix)
public java.lang.String getTempFilePrefix()
public void setTempFileSuffix(java.lang.String tempFileSuffix)
public java.lang.String getTempFileSuffix()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders(java.lang.String url) throws DownloaderException
url
. In fact this just opens an
URLConnection
and returns the output of
getContentType()
.
Note that this method will return null
in several cases,
e.g.:
url
- The resource whose content type should be detected
null
if no content type information is
available.
DownloaderException
public java.lang.String getContentType(java.lang.String url) throws DownloaderException
url
or null
if no such field exists.
Note that this method doesn't follows HTTP 30X redirects.
url
- The url for which the content type should be returned.
DownloaderException
public java.lang.String getContentType(java.net.URL url) throws DownloaderException
url
or null
if no such field exists.
Note that this method doesn't follows HTTP 30X redirects.
url
- The url for which the content type should be returned.
DownloaderException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |