Package utils
Class JarLibraryLoader<T>
java.lang.Object
utils.JarLibraryLoader<T>
- Type Parameters:
T- Library defined interface
Utility library to permit the loading of a library in a JAR.
...
- Since:
- 13/08/2023
- Author:
- Killian Monier and Nidhal Mareghni
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJarLibraryLoader(Class<T> libraryClass, String libraryName) Constructor of this class. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyFileFromJar(String resourcePath, String destinationPath) Copies a file from the JAR resources to a specified destination on the local file system.static <T> JarLibraryLoader<T> Create a new instance ofJarLibraryLoaderProvide the library instance.static StringRetrieves the name of the operating system on which the Java program is running.void
-
Field Details
-
libraryClass
-
libraryName
-
projectPath
-
-
Constructor Details
-
JarLibraryLoader
Constructor of this class.- Parameters:
libraryClass- Class of the library defined interfacelibraryName- Name of the library
-
-
Method Details
-
create
Create a new instance ofJarLibraryLoader- Type Parameters:
T- Library defined interface- Parameters:
libraryClass- Class of the library defined interfacelibraryName- Name of the library- Returns:
- New instance of JarLibraryLoader
-
print_parent_dir
public void print_parent_dir() -
copyFileFromJar
Copies a file from the JAR resources to a specified destination on the local file system.- Parameters:
resourcePath- The path of the file within the JAR resources to copy.destinationPath- The path of the destination where the file will be copied to.- Throws:
IOException- If an I/O error occurs during the copying process.FileNotFoundException- If the specified resource path cannot be found in the JAR resources.
-
getOSName
Retrieves the name of the operating system on which the Java program is running.- Returns:
- The name of the operating system (e.g., "Windows", "Linux", "macOS").
-
getLibraryInstance
Provide the library instance.- Returns:
- The library instance
-