diff --git a/jode/jode/bytecode/package.html b/jode/jode/bytecode/package.html new file mode 100644 index 0000000..1ae5b55 --- /dev/null +++ b/jode/jode/bytecode/package.html @@ -0,0 +1,85 @@ + + +
+ +ClassPath
object giving it the locations where
+it should search for classes. Then you can ask this object for a
+class and get a ClassInfo object. As third step you can actually load
+the class.+ ... + ClassPath path = new ClassPath("/usr/lib/java/lib/classes.zip"); + ClassInfo clazz = path.getClassInfo("java.util.Hashtable"); + + try { + clazz.load(ClassInfo.DECLARATIONS); + } catch (ClassFormatException ex) { + System.err.println("Something is wrong with HashTable, giving up!"); + return; + } catch (IOException ex) { + System.err.println("Can't load HashTable, giving up!"); + return; + } + + MethodInfo[] methods = clazz.getMethods(); + for (int i=0; i< methods.length; i++) { + String type = methods[i].getType(); + if (TypeSignature.getReturnType(type) == TypeSignature.INT_TYPE) + System.out.println("Found integer method: "+method.getName()); + } + ... ++ +You can also use this package to create and write new classes: +
+ ... + ClassPath path = new ClassPath("/usr/lib/java/lib/classes.zip"); + ClassInfo clazz = path.getClassInfo("my.new.Class"); + clazz.setModifiers(Modifiers.PUBLIC); + clazz.setSourceFile("Class.pl"); + clazz.set... + clazz.write(zipOutputStream); + ... ++ +