| Modifier and Type | Class and Description |
|---|---|
| public static interface | JarUtil.
Interface allowing users to provide an URL resolver that will convert custom classloader URLs like Eclipse/OSGi bundleresource: URLs to normal jar: URLs. |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final boolean | |
| private static JarUtil. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static final int | extract(final File dest, final Map<String, String> nativeLibMap, final JarFile jarFile, final String
if not null, only extracts native libraries within this path. nativeLibraryPath, final boolean extractNativeLibraries, final boolean extractClassFiles, final boolean extractOtherFiles)Extract the files of the given jar file. |
| private static final void | fixNativeLibAttribs(final File file)
Mitigate file permission issues of native library files, i.e.:
|
| private static native boolean | |
| public static Uri. | Returns: gluegen-rt.jaras retrieved w/ classJarUri)getJarUri("com.,
i.e. jar:sub_protocol:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.classThe Class's Jar Uri |
| public static Uri. | Returns: gluegen-rt.jarcom.jogamp.common.GlueGenVersionThe Class's |
| public static Uri. | Returns: /com/jogamp/common/GlueGenVersion.classas retrieved w/ classJarUri)getJarUri("com.,
i.e. jar:sub_protocol:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.classThe Class's Jar Uri |
| public static Uri | Returns: jar:file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.classjar:file:/some/path/gluegen-rt.jar!/ jarFileUri, final Uri.com/jogamp/common/GlueGenVersion.class jarEntry
|
| public static JarFile | Returns: JarFile containing the named class within the given ClassLoadercom.jogamp.common.util.cache.TempJarCache clazzBinName, final ClassLoader domain cl)
|
| public static JarFile | Returns: JarFile as named by Uri within the given ClassLoaderjar:file:/some/path/gluegen-rt.jar!/ jarFileUri)
|
| public static Uri | Returns: "jar:sub_protocol:/some/path/gluegen-rt.jar!/""com.jogamp.common.GlueGenVersion" clazzBinName, final ClassLoader cl)The Class's |
| public static Uri | Returns: jar:file:/some/path/gluegen-rt.jar!/file:/some/path/ baseUri, final Uri.gluegen-rt.jar (Uri encoded) jarFileName
|
| public static Uri | Returns: jar:file:/some/path/gluegen-rt.jar!/file:/some/path/gluegen-rt.jar jarSubUri)
|
| public static Uri | Returns: jar:file:/some/path/gluegen-rt.jar!/file:/some/path/gluegen-rt.jar (Uri encoded) jarSubUriS
|
| public static Uri | Returns: "jar:sub_protocol:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class""com.jogamp.common.GlueGenVersion" clazzBinName, final ClassLoader ClassLoader to locate the JarFile cl)The Class's |
| public static Map | |
| public static URI | getRelativeOf(final Class<?>
URI encoded! classFromJavaJar, final String URI encoded! cutOffInclSubDir, final String URI encoded! relResPath)
Deprecated
Use
See getRelativeOf(Class, com..
getRelativeOf(Class, com..
|
| public static Uri | Returns: The resulting resource Uri, which is not tested.Used to get the root Uri for the class's Jar Uri. classFromJavaJar, final Uri.The cut off included sub-directory prepending the relative resource path.
If the root Uri includes cutOffInclSubDir, it is no more added to the result. cutOffInclSubDir,The relative resource path. (Uri encoded) relResPathLocates the |
| public static boolean | Returns: true if the class is loaded from a Jar file, otherwise false."com.jogamp.common.GlueGenVersion" clazzBinName, final ClassLoader cl)Returns |
| public static void | setResolver(final JarUtil.
Resolver to use after querying class file URLs from the classloader.Setting a custom |
| private static final void | validateCertificate(final Certificate[] rootCerts, final JarFile jar, final JarEntry entry, final byte[] buf)
Check the certificates with the ones in the jar file (all must match). |
| public static final void | validateCertificates(final Certificate[] rootCerts, final JarFile jarFile)
Validate the certificates for each native Lib in the jar file. |
| BUFFER_SIZE | back to summary |
|---|---|
| private static final int BUFFER_SIZE | |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| resolver | back to summary |
|---|---|
| private static JarUtil. | |
| JarUtil | back to summary |
|---|---|
| public JarUtil() | |
| extract | back to summary |
|---|---|
| public static final int extract(final File dest, final Map<String, String> nativeLibMap, final JarFile jarFile, final String nativeLibraryPath, final boolean extractNativeLibraries, final boolean extractClassFiles, final boolean extractOtherFiles) throws IOException Extract the files of the given jar file.
If mylib.jar!/sub1/libsour.so -> sour (mapped, unique name) mylib.jar!/sub1/libsweet.so (dropped, root entry favored) mylib.jar!/libsweet.so -> sweet (mapped, root entry favored) mylib.jar!/sweet.dll -> (dropped, not a unix library name)
In order to be compatible with Java Web Start, we need
to extract all root entries from the jar file.
| |
| fixNativeLibAttribs | back to summary |
|---|---|
| private static final void fixNativeLibAttribs(final File file) Mitigate file permission issues of native library files, i.e.:
| |
| fixNativeLibAttribs | back to summary |
|---|---|
| private static native boolean fixNativeLibAttribs(String fname) | |
| getJarBasename | back to summary |
|---|---|
| public static Uri. The Class's Jar Uri sub_protocol may be "file", "http", etc..
| |
| getJarBasename | back to summary |
|---|---|
| public static Uri. The Class's sub_protocol may be "file", "http", etc..
| |
| getJarEntry | back to summary |
|---|---|
| public static Uri. The Class's Jar Uri
| |
| getJarEntryUri | back to summary |
|---|---|
public static Uri getJarEntryUri(final Uri jarFileUri, final Uri.
| |
| getJarFile | back to summary |
|---|---|
public static JarFile getJarFile(final String clazzBinName, final ClassLoader cl) throws IOException, IllegalArgumentException, URISyntaxException
| |
| getJarFile | back to summary |
|---|---|
public static JarFile getJarFile(final Uri jarFileUri) throws IOException, IllegalArgumentException, URISyntaxException
| |
| getJarFileUri | back to summary |
|---|---|
| public static Uri getJarFileUri(final String clazzBinName, final ClassLoader cl) throws IllegalArgumentException, IOException, URISyntaxException The Class's sub_protocol may be "file", "http", etc..
| |
| getJarFileUri | back to summary |
|---|---|
public static Uri getJarFileUri(final Uri baseUri, final Uri.
| |
| getJarFileUri | back to summary |
|---|---|
public static Uri getJarFileUri(final Uri jarSubUri) throws IllegalArgumentException, URISyntaxException
| |
| getJarFileUri | back to summary |
|---|---|
public static Uri getJarFileUri(final Uri.
| |
| getJarUri | back to summary |
|---|---|
| public static Uri getJarUri(final String clazzBinName, final ClassLoader cl) throws IllegalArgumentException, IOException, URISyntaxException The Class's sub_protocol may be "file", "http", etc..
| |
| getNativeLibNames | back to summary |
|---|---|
| public static Map Return a map from native-lib-base-name to entry-name. | |
| getRelativeOf | back to summary |
|---|---|
| public static URI getRelativeOf(final Class<?> classFromJavaJar, final String cutOffInclSubDir, final String relResPath) throws IllegalArgumentException, IOException, URISyntaxException
Deprecated Use See | |
| getRelativeOf | back to summary |
|---|---|
| public static Uri getRelativeOf(final Class<?> classFromJavaJar, final Uri. Locates the class's jar url path + cutOffInclSubDir + relResPath,Example #1 classFromJavaJar = com.lighting.Test (in: file:/storage/TestLighting.jar) cutOffInclSubDir = lights/ relResPath = LightAssets.jar Result : file:/storage/lights/LightAssets.jarExample #2 classFromJavaJar = com.lighting.Test (in: file:/storage/lights/TestLighting.jar) cutOffInclSubDir = lights/ relResPath = LightAssets.jar Result : file:/storage/lights/LightAssets.jar Todo Enhance documentation!
| |
| hasJarUri | back to summary |
|---|---|
| public static boolean hasJarUri(final String clazzBinName, final ClassLoader cl) Returns sub_protocol may be "file", "http", etc..
| |
| setResolver | back to summary |
|---|---|
| public static void setResolver(final JarUtil. Setting a custom
| |
| validateCertificate | back to summary |
|---|---|
| private static final void validateCertificate(final Certificate[] rootCerts, final JarFile jar, final JarEntry entry, final byte[] buf) throws IOException, SecurityException Check the certificates with the ones in the jar file (all must match). | |
| validateCertificates | back to summary |
|---|---|
| public static final void validateCertificates(final Certificate[] rootCerts, final JarFile jarFile) throws IOException, SecurityException Validate the certificates for each native Lib in the jar file. Throws an IOException if any certificate is not valid.
Certificate[] rootCerts = Something.class.getProtectionDomain().
getCodeSource().getCertificates();
| |
This might be required for custom classloader where the URI protocol is unknown to the standard runtime environment.
Note
The provided resolver is only utilized if a given URI's protocol could not be resolved. I.e. it will not be invoked for known protocols like http, https, jar or file.
| resolve | back to summary |
|---|---|
| public URL resolve(URL url) | |