use of net.runelite.asm.visitors.ClassFileVisitor in project runelite by runelite.
the class JarUtil method loadJar.
public static ClassGroup loadJar(File jarfile) throws IOException {
ClassGroup group = new ClassGroup();
try (JarFile jar = new JarFile(jarfile)) {
for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements(); ) {
JarEntry entry = it.nextElement();
if (!entry.getName().endsWith(".class")) {
continue;
}
InputStream is = jar.getInputStream(entry);
ClassReader reader = new ClassReader(is);
ClassFileVisitor cv = new ClassFileVisitor();
reader.accept(cv, ClassReader.SKIP_FRAMES);
group.addClass(cv.getClassFile());
}
}
group.initialize();
return group;
}
use of net.runelite.asm.visitors.ClassFileVisitor in project runelite by runelite.
the class BufferMethodInjector method loadClass.
static ClassFile loadClass(InputStream in) throws IOException {
ClassReader reader = new ClassReader(in);
ClassFileVisitor cv = new ClassFileVisitor();
reader.accept(cv, ClassReader.SKIP_FRAMES);
return cv.getClassFile();
}
use of net.runelite.asm.visitors.ClassFileVisitor in project runelite by runelite.
the class ClassUtil method loadClass.
public static ClassFile loadClass(InputStream in) throws IOException {
ClassReader reader = new ClassReader(in);
ClassFileVisitor cv = new ClassFileVisitor();
reader.accept(cv, ClassReader.SKIP_FRAMES);
return cv.getClassFile();
}
use of net.runelite.asm.visitors.ClassFileVisitor in project runelite by runelite.
the class MixinInjector method loadClass.
private ClassFile loadClass(Class<?> clazz) throws IOException {
try (InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) {
ClassReader reader = new ClassReader(is);
ClassFileVisitor cv = new ClassFileVisitor();
reader.accept(cv, 0);
return cv.getClassFile();
}
}
Aggregations