Java 类jdk.nashorn.internal.ir.debug.NashornClassReader 实例源码

项目:OpenJSharp    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 * @param bytecode  byte array representing bytecode
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:openjdk-jdk10    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 *
 * @param bytecode  byte array representing bytecode
 *
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:openjdk9    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 *
 * @param bytecode  byte array representing bytecode
 *
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:kaziranga    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 *
 * @param bytecode  byte array representing bytecode
 *
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 *
 * @param bytecode  byte array representing bytecode
 *
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:jdk8u_nashorn    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 *
 * @param bytecode  byte array representing bytecode
 *
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}
项目:infobip-open-jdk-8    文件:ClassEmitter.java   
/**
 * Disassemble an array of byte code.
 * @param bytecode  byte array representing bytecode
 * @return disassembly as human readable string
 */
static String disassemble(final byte[] bytecode) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (final PrintWriter pw = new PrintWriter(baos)) {
        final NashornClassReader cr = new NashornClassReader(bytecode);
        final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() {
            @Override
            public Context run() {
                return Context.getContext();
            }
        });
        final TraceClassVisitor tcv = new TraceClassVisitor(null, new NashornTextifier(ctx.getEnv(), cr), pw);
        cr.accept(tcv, 0);
    }

    final String str = new String(baos.toByteArray());
    return str;
}