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 ClassLoader |
createURLClassLoaderFromPathString(String classpathStr) |
Create a custom URLClassLoader from a classpath path string.
|
static List<String> |
getJreJarPaths() |
|
static Set<String> |
getJreLibOrExtJars() |
|
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,
ScanSpec scanSpec,
LogNode log) |
|
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)
pathStr
- The path to split.public static ClassLoader createURLClassLoaderFromPathString(String classpathStr)
classpathStr
- The classpath string.URLClassLoader
that can load from the path string.public static String pathElementsToPathStr(Object... pathElts)
pathElts
- The path elements.public static String pathElementsToPathStr(Iterable<?> pathElts)
pathElts
- The path elements.public static String leafName(String path)
path
- A file path.public static List<String> getJreJarPaths()
public static Set<String> getJreLibOrExtJars()
public static boolean isJREJar(String filePath, ScanSpec scanSpec, LogNode log)
filePath
- A file path.scanSpec
- The ScanSpec
.log
- The log.public static boolean isInSystemPackageOrModule(String packageOrModuleName)
packageOrModuleName
- The class, package or module name.public static long countBytesBeforePKMarker(File zipfile) throws IOException
zipfile
- The zipfile.IOException
- If the file could not be read.public static void stripSFXHeader(File srcZipfile, long sfxHeaderBytes, File destZipfile) throws IOException
srcZipfile
- The source zipfile.sfxHeaderBytes
- The number of bytes of the header to strip.destZipfile
- The destination to save to.IOException
- If the operation could not be completed.public static void logJavaInfo(LogNode log)
log
- The log.Copyright © 2018. All rights reserved.