private static Class loadCompiledScriptFromClass(Ruby runtime, InputStream in) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buf = new byte[8192]; int read; while ((read = in.read(buf)) != -1) { baos.write(buf, 0, read); } buf = baos.toByteArray(); JRubyClassLoader jcl = runtime.getJRubyClassLoader(); OneShotClassLoader oscl = new OneShotClassLoader(jcl); ClassReader cr = new ClassReader(buf); String className = cr.getClassName().replace('/', '.'); return oscl.defineClass(className, buf); }
private String getClassName() { if (cv instanceof ClassWriter) { return new ClassReader(((ClassWriter) cv).toByteArray()).getClassName(); } return "(unknown class)"; }
private String getClassName() { if (cv instanceof ClassWriter) { return new ClassReader(((ClassWriter) cv).toByteArray()).getClassName(); } return "(unknown class)"; }
private static Class loadCompiledScriptFromClass(Ruby runtime, InputStream in) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buf = new byte[8192]; int read; while ((read = in.read(buf)) != -1) { baos.write(buf, 0, read); } buf = baos.toByteArray(); JRubyClassLoader jcl = runtime.getJRubyClassLoader(); OneShotClassLoader oscl = new OneShotClassLoader(jcl); ClassReader cr = new ClassReader(buf); String className = cr.getClassName().replace('/', '.'); return oscl.defineClass(className, buf); }
public void end(Runnable locals) { if (DEBUG) { PrintWriter pw = new PrintWriter(System.out); String className = "(unknown class)"; if (cv instanceof ClassWriter) { className = new ClassReader(((ClassWriter)cv).toByteArray()).getClassName(); } if (name != null) { pw.write("*** Dumping " + className + "." + name + " ***\n"); } else { pw.write("*** Dumping ***\n"); } printer.print(pw); pw.flush(); } getMethodVisitor().visitLabel(end); locals.run(); getMethodVisitor().visitMaxs(1, 1); getMethodVisitor().visitEnd(); }
public void end(Runnable locals) { if (DEBUG) { PrintWriter pw = new PrintWriter(System.out); String className = "(unknown class)"; if (cv instanceof ClassWriter) { className = new ClassReader(((ClassWriter)cv).toByteArray()).getClassName(); } if (name != null) { pw.write("*** Dumping " + className + "." + name + " ***\n"); } else { pw.write("*** Dumping ***\n"); } printer.print(pw); pw.flush(); } getMethodVisitor().visitLabel(end); locals.run(); getMethodVisitor().visitMaxs(1, 1); getMethodVisitor().visitEnd(); }
String className = cr.getClassName().replace('/', '.');
String className = cr.getClassName().replace('/', '.');
bytecode = new byte[(int)fis.getChannel().size()]; fis.read(bytecode); name = new ClassReader(bytecode).getClassName(); return; } catch (Exception e) {
bytecode = new byte[(int)fis.getChannel().size()]; fis.read(bytecode); name = new ClassReader(bytecode).getClassName(); return; } catch (Exception e) {