Package pro.gravit.launcher.base
Class Downloader
java.lang.Object
pro.gravit.launcher.base.Downloader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HttpClientprotected final ExecutorServiceprotected CompletableFuture<Void> protected final Queue<Downloader.DownloadTask> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()downloadFile(String url, Path path, long size, Downloader.DownloadCallback callback, ExecutorService executor) downloadFile(String url, Path path, Downloader.DownloadCallback callback, ExecutorService executor) downloadFile(URI uri, Path path) static DownloaderdownloadFile(URI uri, Path path, ExecutorService executor) downloadFiles(List<Downloader.SizedFile> files, String baseURL, Path targetDir, Downloader.DownloadCallback callback, ExecutorService executor, int threads) static DownloaderdownloadList(List<Downloader.SizedFile> files, String baseURL, Path targetDir, Downloader.DownloadCallback callback, ExecutorService executor, int threads) static ThreadFactorygetDaemonThreadFactory(String name) booleanprotected Downloader.ProgressTrackingBodyHandler<Path> makeBodyHandler(Path file, Downloader.DownloadCallback callback) protected HttpRequestmakeHttpRequest(URI baseUri, String filePath) static SSLContextstatic SSLSocketFactorystatic DownloadernewDownloader(ExecutorService executor) static HttpClient.Builderprotected Downloader.DownloadTasksendAsync(Downloader.SizedFile file, URI baseUri, Path targetDir, Downloader.DownloadCallback callback)
-
Field Details
-
client
-
executor
-
tasks
-
future
-
-
Constructor Details
-
Downloader
-
-
Method Details
-
getDaemonThreadFactory
-
newHttpClientBuilder
-
makeSSLSocketFactory
public static SSLSocketFactory makeSSLSocketFactory() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, KeyManagementException -
makeSSLContext
public static SSLContext makeSSLContext() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, KeyManagementException -
downloadFile
-
downloadList
public static Downloader downloadList(List<Downloader.SizedFile> files, String baseURL, Path targetDir, Downloader.DownloadCallback callback, ExecutorService executor, int threads) throws Exception - Throws:
Exception
-
newDownloader
-
cancel
public void cancel() -
isCanceled
public boolean isCanceled() -
getFuture
-
downloadFile
-
downloadFile
public CompletableFuture<Void> downloadFile(String url, Path path, Downloader.DownloadCallback callback, ExecutorService executor) throws Exception - Throws:
Exception
-
downloadFile
public CompletableFuture<Void> downloadFile(String url, Path path, long size, Downloader.DownloadCallback callback, ExecutorService executor) throws Exception - Throws:
Exception
-
downloadFiles
public CompletableFuture<Void> downloadFiles(List<Downloader.SizedFile> files, String baseURL, Path targetDir, Downloader.DownloadCallback callback, ExecutorService executor, int threads) throws Exception - Throws:
Exception
-
sendAsync
protected Downloader.DownloadTask sendAsync(Downloader.SizedFile file, URI baseUri, Path targetDir, Downloader.DownloadCallback callback) throws Exception - Throws:
Exception
-
makeHttpRequest
- Throws:
URISyntaxException
-
makeBodyHandler
protected Downloader.ProgressTrackingBodyHandler<Path> makeBodyHandler(Path file, Downloader.DownloadCallback callback)
-