public class JarUtils extends Object
Modifier and Type | Field | Description |
---|---|---|
static String[] |
SYSTEM_PACKAGE_PATH_PREFIXES |
Prefixes of system (JRE) packages, turned into path form (with slashes instead of dots).
|
static String[] |
SYSTEM_PACKAGE_PREFIXES |
Prefixes of system (JRE) packages.
|
Constructor | Description |
---|---|
JarUtils() |
Modifier and Type | Method | Description |
---|---|---|
static long |
countBytesBeforePKMarker(File zipfile) |
Count the number of bytes before the characters "PK" in a zipfile.
|
static Set<String> |
getJreExtJars() |
Get the paths for any JRE/JDK "lib/" jars.
|
static List<String> |
getJreJarPaths() |
Get the paths of jars in all JRE/JDK system directories, with any rt.jar listed first.
|
static Set<String> |
getJreLibJars() |
Get the paths for any JRE/JDK "ext/" jars.
|
static boolean |
isInSystemPackageOrModule(String packageOrModuleName) |
Return true if the given class name, package name or module name has a system package or module prefix
|
static boolean |
isJREJar(String filePath,
Set<String> whitelistedLibOrExtJarPaths,
Set<String> blacklistedLibOrExtJarPaths,
LogNode log) |
Determine whether a given jarfile is in a JRE system directory (jre, jre/lib, jre/lib/ext, etc.).
|
static String |
leafName(String path) |
Returns the leafname of a path, after first stripping off everything after the first '!', if present.
|
static void |
logJavaInfo(LogNode log) |
Log the Java version and the JRE paths that were found.
|
static String |
pathElementsToPathStr(Iterable<?> pathElts) |
Get a set of path elements as a string, from an array of objects (e.g.
|
static String |
pathElementsToPathStr(Object... pathElts) |
Get a set of path elements as a string, from an array of objects (e.g.
|
static String[] |
smartPathSplit(String pathStr) |
Split a path on File.pathSeparator (':' on Linux, ';' on Windows), but also allow for the use of URLs with
protocol specifiers, e.g.
|
static void |
stripSFXHeader(File srcZipfile,
long sfxHeaderBytes,
File destZipfile) |
Strip the self-extracting archive header from the beginning of a zipfile.
|
public static final String[] SYSTEM_PACKAGE_PREFIXES
public static final String[] SYSTEM_PACKAGE_PATH_PREFIXES
public static String[] smartPathSplit(String pathStr)
public static String pathElementsToPathStr(Object... pathElts)
public static String pathElementsToPathStr(Iterable<?> pathElts)
public static String leafName(String path)
public static List<String> getJreJarPaths()
public static boolean isJREJar(String filePath, Set<String> whitelistedLibOrExtJarPaths, Set<String> blacklistedLibOrExtJarPaths, LogNode log)
public static boolean isInSystemPackageOrModule(String packageOrModuleName)
public static long countBytesBeforePKMarker(File zipfile) throws IOException
IOException
public static void stripSFXHeader(File srcZipfile, long sfxHeaderBytes, File destZipfile) throws IOException
IOException
public static void logJavaInfo(LogNode log)
Copyright © 2018. All rights reserved.