59 |
public static class JarFileCache |
public static class JarFileCache |
60 |
{ |
{ |
61 |
private static Hashtable cache = new Hashtable(); |
private static Hashtable cache = new Hashtable(); |
62 |
private static final int READBUFSIZE = 1024; |
private static final int READBUFSIZE = 4*1024; |
63 |
private static boolean is_trying = false; |
private static boolean is_trying = false; |
64 |
|
|
65 |
public static synchronized JarFile get(URL url) throws IOException{ |
public static synchronized JarFile get(URL url) throws IOException{ |
79 |
FileOutputStream fos = new FileOutputStream(f = File.createTempFile("cache", "jar")); |
FileOutputStream fos = new FileOutputStream(f = File.createTempFile("cache", "jar")); |
80 |
int len = 0; |
int len = 0; |
81 |
while((len = is.read(buf)) != -1){ |
while((len = is.read(buf)) != -1){ |
82 |
fos.write(buf); |
fos.write(buf, 0, len); |
83 |
} |
} |
84 |
fos.close(); |
fos.close(); |
85 |
// Always verify the Manifest, open read only and delete when done. |
// Always verify the Manifest, open read only and delete when done. |