Package com.graphhopper.util
Class Downloader
java.lang.Object
com.graphhopper.util.Downloader
- Author:
- Peter Karich
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateConnection(String urlStr) voiddownloadAndUnzip(String url, String toFolder, LongConsumer progressListener) downloadAsString(String url, boolean readErrorStreamNoException) voiddownloadFile(String url, String toFile) fetch(HttpURLConnection connection, boolean readErrorStreamNoException) This method initiates a connect call of the provided connection and returns the response stream.static voidsetReferrer(String referrer) setTimeout(int timeout)
-
Constructor Details
-
Downloader
-
-
Method Details
-
main
- Throws:
IOException
-
setTimeout
-
setReferrer
-
fetch
public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException This method initiates a connect call of the provided connection and returns the response stream. It only returns the error stream if it is available and readErrorStreamNoException is true otherwise it throws an IOException if an error happens. Furthermore it wraps the stream to decompress it if the connection content encoding is specified.- Throws:
IOException
-
fetch
- Throws:
IOException
-
createConnection
- Throws:
IOException
-
downloadFile
- Throws:
IOException
-
downloadAndUnzip
public void downloadAndUnzip(String url, String toFolder, LongConsumer progressListener) throws IOException - Throws:
IOException
-
downloadAsString
- Throws:
IOException
-