summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WobClassLoader.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/WobClassLoader.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/WobClassLoader.java')
-rw-r--r--NET/worlds/scape/WobClassLoader.java144
1 files changed, 144 insertions, 0 deletions
diff --git a/NET/worlds/scape/WobClassLoader.java b/NET/worlds/scape/WobClassLoader.java
new file mode 100644
index 0000000..2ce876b
--- /dev/null
+++ b/NET/worlds/scape/WobClassLoader.java
@@ -0,0 +1,144 @@
+/* */ 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<String, WobClassLoader> 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<String, Class<?>> 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
+ */ \ No newline at end of file