public class Downloader extends Object
Constructor and Description |
---|
Downloader(String userAgent) |
Modifier and Type | Method and Description |
---|---|
HttpURLConnection |
createConnection(String urlStr) |
void |
downloadAndUnzip(String url,
String toFolder,
ProgressListener progressListener) |
String |
downloadAsString(String url,
boolean readErrorStreamNoException) |
void |
downloadFile(String url,
String toFile) |
InputStream |
fetch(HttpURLConnection connection,
boolean readErrorStreamNoException)
This method initiates a connect call of the provided connection and returns the response
stream.
|
InputStream |
fetch(String url) |
static void |
main(String[] args) |
Downloader |
setReferrer(String referrer) |
Downloader |
setTimeout(int timeout) |
public Downloader(String userAgent)
public static void main(String[] args) throws IOException
IOException
public Downloader setTimeout(int timeout)
public Downloader setReferrer(String referrer)
public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException
IOException
public InputStream fetch(String url) throws IOException
IOException
public HttpURLConnection createConnection(String urlStr) throws IOException
IOException
public void downloadFile(String url, String toFile) throws IOException
IOException
public void downloadAndUnzip(String url, String toFolder, ProgressListener progressListener) throws IOException
IOException
public String downloadAsString(String url, boolean readErrorStreamNoException) throws IOException
IOException
Copyright © 2012–2019. All rights reserved.