Object JarUtilities.Companion
-
- All Implemented Interfaces:
public class JarUtilities.CompanionExtraction of files and folders out of the running jar, used to seed the home directory.
-
-
Field Summary
Fields Modifier and Type Field Description public final static JarUtilities.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitcopyFileFromJar(String fileToCopy, Boolean replaceIfExists, Class<?> classToCopyFrom, String directory)Copy a file from inside our JAR-file to the host filesystem. final BooleancopyFileFromJar(String fileToCopy, Class<?> identifierClass, String directory)Copy a file from inside our JAR-file to the host filesystem. final UnitcopyFileFromJar(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 BooleancopyFileFromJar(String fileToCopy, File destinationFile, Class<?> identifierClass)Copy a file from inside our JAR-file to the host filesystem to the specified destination. final UnitcopyFolderFromJar(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. -
-
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 aslog4j2.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 aslog4j2.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 aslog4j2.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 aslog4j2.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.
-
-
-
-