Object JarUtilities.Companion

  • All Implemented Interfaces:

    
    public class JarUtilities.Companion
    
                        

    Extraction of files and folders out of the running jar, used to seed the home directory.

    • 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

      • 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

        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.

      • 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

      • 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

        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.

      • 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>

      • 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.

        classInJar — Class for which to acquire information about its JAR-file and system.