Package dev.treset.mcdl.java
Class JavaDL
java.lang.Object
dev.treset.mcdl.java.JavaDL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddownloadJavaFile(JavaFile file, File baseDir) Downloads a single java file to the specified directory while creating any necessary subdirectories.static voiddownloadJavaFiles(List<JavaFile> files, File baseDir) Downloads all java files in a list to the specified directory while creating any necessary subdirectories.static voiddownloadJavaFiles(List<JavaFile> files, File baseDir, Consumer<dev.treset.mcdl.util.DownloadStatus> statusCallback) Downloads all java files in a list to the specified directory while creating any necessary subdirectories.static dev.treset.mcdl.util.cache.Caching<HttpResponse<byte[]>>getJavaFiles(String url) Gets the java files from the specified url.static JavaRuntimesGets a list of all available java runtimes.static Stringstatic voidsetCaching(dev.treset.mcdl.util.cache.Caching<HttpResponse<byte[]>> caching) Sets a caching strategy this module
-
Constructor Details
-
JavaDL
public JavaDL()
-
-
Method Details
-
downloadJavaFiles
public static void downloadJavaFiles(List<JavaFile> files, File baseDir) throws dev.treset.mcdl.exception.FileDownloadException Downloads all java files in a list to the specified directory while creating any necessary subdirectories.- Parameters:
files- The list of files to downloadbaseDir- The directory to download the files to- Throws:
dev.treset.mcdl.exception.FileDownloadException- If there is an error downloading or writing a file
-
downloadJavaFiles
public static void downloadJavaFiles(List<JavaFile> files, File baseDir, Consumer<dev.treset.mcdl.util.DownloadStatus> statusCallback) throws dev.treset.mcdl.exception.FileDownloadException Downloads all java files in a list to the specified directory while creating any necessary subdirectories.- Parameters:
files- The list of files to downloadbaseDir- The directory to download the files tostatusCallback- A callback to be called when a file is downloaded- Throws:
dev.treset.mcdl.exception.FileDownloadException- If there is an error downloading or writing a file
-
downloadJavaFile
public static void downloadJavaFile(JavaFile file, File baseDir) throws dev.treset.mcdl.exception.FileDownloadException Downloads a single java file to the specified directory while creating any necessary subdirectories.- Parameters:
file- The file to downloadbaseDir- The directory to download the file to- Throws:
dev.treset.mcdl.exception.FileDownloadException- If there is an error downloading or writing the file
-
getJavaRuntimes
Gets a list of all available java runtimes.- Returns:
- A list of java runtimes
- Throws:
dev.treset.mcdl.exception.FileDownloadException- If there is an error downloading or parsing the runtimes
-
getJavaFiles
public static List<JavaFile> getJavaFiles(String url) throws dev.treset.mcdl.exception.FileDownloadException Gets the java files from the specified url.- Parameters:
url- The url to get the java files from. Typically found inJavaRuntimeRelease.getManifest()- Returns:
- A list of java file objects
- Throws:
dev.treset.mcdl.exception.FileDownloadException- If there is an error downloading or parsing the file
-
setCaching
Sets a caching strategy this module- Parameters:
caching- The caching strategy to use
-
getCaching
-
getJavaRuntimeUrl
-