Class JavaDL

java.lang.Object
dev.treset.mcdl.java.JavaDL

public class JavaDL extends Object
  • 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 download
      baseDir - 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 download
      baseDir - The directory to download the files to
      statusCallback - 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 download
      baseDir - The directory to download the file to
      Throws:
      dev.treset.mcdl.exception.FileDownloadException - If there is an error downloading or writing the file
    • getJavaRuntimes

      public static JavaRuntimes getJavaRuntimes() throws dev.treset.mcdl.exception.FileDownloadException
      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 in JavaRuntimeRelease.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

      public static void setCaching(dev.treset.mcdl.util.cache.Caching<HttpResponse<byte[]>> caching)
      Sets a caching strategy this module
      Parameters:
      caching - The caching strategy to use
    • getCaching

      public static dev.treset.mcdl.util.cache.Caching<HttpResponse<byte[]>> getCaching()
    • getJavaRuntimeUrl

      public static String getJavaRuntimeUrl()