/* */ package NET.worlds.scape; /* */ /* */ import java.io.File; /* */ import java.io.FileInputStream; /* */ import java.io.InputStream; /* */ import java.util.Hashtable; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class WobClassLoader /* */ extends ClassLoader /* */ { /* 28 */ static Hashtable loaders = new Hashtable(); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static synchronized Class get(String zipName, String cname) /* */ { /* 41 */ WobClassLoader cl = (WobClassLoader)loaders.get(zipName); /* */ /* 43 */ if (cl == null) { /* 44 */ cl = new WobClassLoader(zipName); /* 45 */ loaders.put(zipName, cl); /* */ } /* */ try /* */ { /* 49 */ return cl.loadClass(cname, true); /* */ } catch (ClassNotFoundException e) {} /* 51 */ return null; /* */ } /* */ /* */ /* 55 */ Hashtable> classes = new Hashtable(); /* */ String zipName; /* */ /* */ public WobClassLoader(String n) { /* 59 */ this.zipName = n; /* */ } /* */ /* */ /* */ /* */ /* */ protected synchronized Class loadClass(String cname, boolean resolve) /* */ throws ClassNotFoundException /* */ { /* 68 */ Class cl = (Class)this.classes.get(cname); /* 69 */ if (cl == null) /* */ { /* */ /* */ /* */ /* */ /* */ /* */ try /* */ { /* */ /* */ /* */ /* */ /* 82 */ return findSystemClass(cname); /* */ } /* */ catch (NoClassDefFoundError localNoClassDefFoundError) {}catch (ClassNotFoundException localClassNotFoundException) {} /* */ /* 86 */ byte[] data = loadData(cname); /* 87 */ if (data != null) { /* */ try { /* 89 */ cl = defineClass(null, data, 0, data.length); /* */ } catch (ClassFormatError e) { /* 91 */ throw new ClassNotFoundException(cname); /* */ } /* */ } /* */ /* 95 */ if ((cl == null) || (!cname.equals(cl.getName()))) { /* 96 */ throw new ClassNotFoundException(cname); /* */ } /* 98 */ this.classes.put(cname, cl); /* */ } /* 100 */ if (resolve) /* 101 */ resolveClass(cl); /* 102 */ return cl; /* */ } /* */ /* */ /* */ private byte[] loadData(String cname) /* */ { /* 108 */ byte[] data = null; /* */ /* */ /* */ /* */ /* */ /* 114 */ InputStream in = null; /* */ try { /* 116 */ if (cname != null) { /* 117 */ File file = new File(this.zipName); /* 118 */ int len = (int)file.length(); /* 119 */ in = new FileInputStream(file); /* */ /* 121 */ data = new byte[len]; /* 122 */ if (in.read(data) == len) { /* 123 */ return data; /* */ } /* */ } /* */ } catch (Exception localException1) {}finally { /* 127 */ if (in != null) { /* 128 */ try { in.close(); /* */ } /* */ catch (Exception localException3) {} /* */ } /* */ } /* 127 */ if (in != null) /* 128 */ try { in.close(); /* */ } catch (Exception localException4) {} /* 130 */ return null; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WobClassLoader.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */