public class HTTPFileRetriever extends Object
| Constructor and Description |
|---|
HTTPFileRetriever(okhttp3.OkHttpClient httpClient) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
downloadFile(String url,
Path toPath)
Request that a file be downloaded and stored to the provided location.
|
boolean |
downloadFileIfNotModified(String url,
Path toPath)
Request that a file be downloaded and stored to the provided location.
|
Optional<String> |
fetchFile(String url)
Request file.
|
Optional<byte[]> |
fetchFileBytes(String url)
Request file bytes.
|
Optional<byte[]> |
fetchFileBytesIfNotModified(String url)
Request file bytes by sending an "If-Modified-Since" header so that the file won't be fetched if it hasn't been
modified since the last request.
|
Optional<String> |
fetchFileIfNotModified(String url)
Request file by sending an "If-Modified-Since" header so that the file won't be fetched if it hasn't been
modified since the last request.
|
@Inject public HTTPFileRetriever(okhttp3.OkHttpClient httpClient)
public Optional<String> fetchFile(String url) throws IOException
IOExceptionpublic Optional<byte[]> fetchFileBytes(String url) throws IOException
IOExceptionpublic boolean downloadFile(String url, Path toPath) throws IOException
IOExceptionpublic Optional<String> fetchFileIfNotModified(String url) throws IOException
IOExceptionpublic Optional<byte[]> fetchFileBytesIfNotModified(String url) throws IOException
IOExceptionpublic boolean downloadFileIfNotModified(String url, Path toPath) throws IOException
IOExceptionCopyright © 2012–2021 Graylog, Inc.. All rights reserved.