aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/cache
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-29 04:59:42 +0100
committerSven Gothel <[email protected]>2011-11-29 04:59:42 +0100
commit04391a3f417e10e1b6dafbd8becc63659af633c3 (patch)
tree2b9a5f8dc81b7631d34d306894387d3bac4b9bec /src/java/com/jogamp/common/util/cache
parent60ea6727f1a089f6afd17fcea3bd7d29353af9b4 (diff)
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)'
Diffstat (limited to 'src/java/com/jogamp/common/util/cache')
-rw-r--r--src/java/com/jogamp/common/util/cache/TempJarCache.java13
1 files changed, 13 insertions, 0 deletions
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'