Package org.kiwiproject.jar
Class Jars
- java.lang.Object
-
- org.kiwiproject.jar.Jars
-
public class Jars extends Object
Utilities for working with Java JAR files.
-
-
Constructor Summary
Constructors Constructor Description Jars()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<String>getDirectoryPath(Class<?> classInJar)Get the directory path of the JAR file that the given class lives in, or an emptyOptionalif the path could not be obtained for any reason.static Optional<String>getPath(Class<?> classInJar)Get the path of the JAR file that the given class lives in, or an emptyOptionalif the path could not be obtained for any reason.static List<String>getPathComponents(Class<?> classInJar)Get the path components of the JAR file path that the given class lives in, or an empty list if the path components could not be obtained.
-
-
-
Method Detail
-
getPathComponents
public static List<String> getPathComponents(Class<?> classInJar)
Get the path components of the JAR file path that the given class lives in, or an empty list if the path components could not be obtained.- Parameters:
classInJar- the class which resides in the JAR you want to find- Returns:
- a mutable list of path components if found, or an immutable empty list if not found or an exception is thrown attempting to get the path
-
getPath
public static Optional<String> getPath(Class<?> classInJar)
Get the path of the JAR file that the given class lives in, or an emptyOptionalif the path could not be obtained for any reason.- Parameters:
classInJar- the class which resides in the JAR you want to find- Returns:
- optional containing the path if found, or an empty optional
-
getDirectoryPath
public static Optional<String> getDirectoryPath(Class<?> classInJar)
Get the directory path of the JAR file that the given class lives in, or an emptyOptionalif the path could not be obtained for any reason.- Parameters:
classInJar- the class which resides in the JAR you want to find- Returns:
- optional containing the directory path if found, or an empty optional
-
-