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,
LongConsumer 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
IOExceptionpublic Downloader setTimeout(int timeout)
public Downloader setReferrer(String referrer)
public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException
IOExceptionpublic InputStream fetch(String url) throws IOException
IOExceptionpublic HttpURLConnection createConnection(String urlStr) throws IOException
IOExceptionpublic void downloadFile(String url, String toFile) throws IOException
IOExceptionpublic void downloadAndUnzip(String url, String toFolder, LongConsumer progressListener) throws IOException
IOExceptionpublic String downloadAsString(String url, boolean readErrorStreamNoException) throws IOException
IOExceptionCopyright © 2012–2022. All rights reserved.