Object JarUtilities.Companion

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit copyFileFromJar(String fileToCopy, Boolean replaceIfExists, Class<?> classToCopyFrom, String directory) Copy a file from inside our JAR-file to the host filesystem.
      final Boolean copyFileFromJar(String fileToCopy, Class<?> identifierClass, String directory) Copy a file from inside our JAR-file to the host filesystem.
      final Unit copyFileFromJar(String fileToCopy, File destinationFile, Boolean replaceIfExists, Class<?> identifierClass) Copy a file from inside our JAR-file to the host filesystem to the specified destination, replacing an already existing file.
      final Boolean copyFileFromJar(String fileToCopy, File destinationFile, Class<?> identifierClass) Copy a file from inside our JAR-file to the host filesystem to the specified destination.
      final Unit copyFolderFromJar(Class<?> classToRetrieveHomeFor, String directoryToCopy, String destinationDirectory, String jarDirectoryPrefix, Regex fileEnding, File tempDir) Copy a folder from inside a JAR-file to the host filesystem.
      final HashMap<String, String> jarInformation(Class<?> classInJar) Retrieve information about the environment for the given class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • copyFileFromJar

         final Unit copyFileFromJar(String fileToCopy, Boolean replaceIfExists, Class<?> classToCopyFrom, String directory)

        Copy a file from inside our JAR-file to the host filesystem. The file will create exactly as specified in the parameter.

        Example:

        • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

        Parameters:
        fileToCopy - The source-file in the JAR you wish to copy outside the JAR.
        replaceIfExists - Whether to replace the file, if it already exists.
        classToCopyFrom - The class of the JAR from which you want to copy from.
        directory - The directory where the file should be copied to.
      • copyFileFromJar

         final Boolean copyFileFromJar(String fileToCopy, Class<?> identifierClass, String directory)

        Copy a file from inside our JAR-file to the host filesystem. The file will be created with exactly the same path specified in the parameter.

        Example:

        • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

        Parameters:
        fileToCopy - The source-file in the JAR you wish to copy outside the JAR.
        identifierClass - The class of the JAR from which to get the resource.
        directory - The directory to copy the file to.
        Returns:

        true if the file was created, false otherwise.

      • copyFileFromJar

         final Unit copyFileFromJar(String fileToCopy, File destinationFile, Boolean replaceIfExists, Class<?> identifierClass)

        Copy a file from inside our JAR-file to the host filesystem to the specified destination, replacing an already existing file. The file will be created with exactly the same path specified in the parameter.

        Example:

        • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

        Parameters:
        fileToCopy - The source-file in the JAR you wish to copy outside the JAR.
        destinationFile - The file to which to copy to.
        replaceIfExists - Whether to replace the file, if it already exists.
        identifierClass - The class of the JAR from which to get the resource.
      • copyFileFromJar

         final Boolean copyFileFromJar(String fileToCopy, File destinationFile, Class<?> identifierClass)

        Copy a file from inside our JAR-file to the host filesystem to the specified destination. The file will be created with exactly the same path specified in the parameter.

        Example:

        • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

        Parameters:
        fileToCopy - The source-file in the JAR you wish to copy outside the JAR.
        destinationFile - The file to which to copy to.
        identifierClass - The class of the JAR from which to get the resource.
        Returns:

        true if the file was created, false otherwise.

      • copyFolderFromJar

         final Unit copyFolderFromJar(Class<?> classToRetrieveHomeFor, String directoryToCopy, String destinationDirectory, String jarDirectoryPrefix, Regex fileEnding, File tempDir)

        Copy a folder from inside a JAR-file to the host filesystem. The specified folder will be copied, along with all resources inside it, recursively, to the specified destination.<br>

        Parameters:
        classToRetrieveHomeFor - Path to either the JAR-file from which to copy a folder from, or to the class when running in a dev-environment.
        directoryToCopy - Path to the directory inside the JAR-file you want to copy.
        destinationDirectory - Path to the destination directory you want to copy source to.
        jarDirectoryPrefix - A prefix to remove when checking for existence of source inside the JAR-file.
        fileEnding - The file-ending to filter for.
      • jarInformation

         final HashMap<String, String> jarInformation(Class<?> classInJar)

        Retrieve information about the environment for the given class.

        Available key-value-pairs:

        • jarPath - The path to the JAR-file.

        • jarName - The name of the JAR-file.

        • javaVersion - The version of the Java

        • installation used.

        • osArch - Architecture of the system.

        • osName - Name of the operating system.

        • osVersion - Version of the operating system.

        Parameters:
        classInJar - Class for which to acquire information about its JAR-file and system.
        Returns:

        A hashmap containing key-value-pairs with information about the JAR-file and system.