From 04391a3f417e10e1b6dafbd8becc63659af633c3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 29 Nov 2011 04:59:42 +0100 Subject: JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)' --- src/java/com/jogamp/common/util/cache/TempJarCache.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/java/com/jogamp/common/util/cache') diff --git a/src/java/com/jogamp/common/util/cache/TempJarCache.java b/src/java/com/jogamp/common/util/cache/TempJarCache.java index 7e90f7d..71a12e7 100644 --- a/src/java/com/jogamp/common/util/cache/TempJarCache.java +++ b/src/java/com/jogamp/common/util/cache/TempJarCache.java @@ -34,6 +34,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; import java.security.cert.Certificate; import java.util.Enumeration; import java.util.HashMap; @@ -44,6 +46,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import com.jogamp.common.os.NativeLibrary; +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.JarUtil; public class TempJarCache { @@ -266,6 +269,16 @@ public class TempJarCache { return null; } + public static final URL getResource(String name) throws MalformedURLException { + checkInitialized(); + final File f = new File(tmpFileCache.getTempDir(), name); + if(f.exists()) { + return IOUtil.toURLSimple(f); + } + return null; + } + + /** * Bootstrapping version extracting the JAR files root entry containing libBaseName, * assuming it's a native library. This is used to get the 'gluegen-rt' -- cgit v1.2.3