Package org.objectweb.asm

Examples of org.objectweb.asm.ClassAdapter


    }

    private static byte[] transformClass(final byte[] clazz) {
        ClassReader cr = new ClassReader(clazz);
        ClassWriter cw = new ClassWriter(0);
        cr.accept(new ClassAdapter(cw) {

            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
View Full Code Here


    }

    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        ClassWriter cw = new ClassWriter(0);
        cr.accept(new ClassAdapter(cw) {
            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String signature,
View Full Code Here

        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List classAttributes = new ArrayList();
        m_reader.accept(
                new ClassAdapter(m_writer) {
                    public void visitAttribute(final Attribute attribute) {
                        if (attribute instanceof CustomAttribute) {
                            CustomAttribute customAttribute = (CustomAttribute)attribute;
                            byte[] bytes = customAttribute.getBytes();
                            try {
View Full Code Here

        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List methodAttributes = new ArrayList();
        m_reader.accept(
                new ClassAdapter(m_writer) {
                    public CodeVisitor visitMethod(
                            final int access,
                            final String name,
                            final String desc,
                            final String[] exceptions,
View Full Code Here

        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List fieldAttributes = new ArrayList();
        m_reader.accept(
                new ClassAdapter(m_writer) {
                    public void visitField(
                            final int access,
                            final String name,
                            final String desc,
                            final Object value,
View Full Code Here

    }
   
    public static String[] getClassInfo(ClassReader r) {
        final List array = new ArrayList();
        try {
            r.accept(new ClassAdapter(null) {
                public void visit(int version,
                                  int access,
                                  String name,
                                  String superName,
                                  String[] interfaces,
View Full Code Here

    }
   
    public static String[] getClassInfo(ClassReader r) {
        final List array = new ArrayList();
        try {
            r.accept(new ClassAdapter(null) {
                public void visit(int version,
                                  int access,
                                  String name,
                                  String superName,
                                  String[] interfaces,
View Full Code Here

   */
  public static byte[] instrument(final byte[] source,
      final String accessFieldName) {
    final ClassReader reader = new ClassReader(source);
    final ClassWriter writer = new ClassWriter(reader, 0);
    reader.accept(new ClassAdapter(writer) {

      @Override
      public void visitEnd() {
        createDataField(cv, accessFieldName);
        super.visitEnd();
View Full Code Here

     * @throws IOException if there was an error reading the class from the input stream.
     */
    public static byte[] rewriteClass(InputStream source) throws IOException {
        ClassReader cr = new ClassReader(source);
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS/* | ClassWriter.COMPUTE_FRAMES*/);
        ClassAdapter ca = new NullingClassAdapter(cw);
        cr.accept(ca, 0);
       
        return cw.toByteArray();
    }
View Full Code Here

    public HeapClass(ClassVisitor cv,
                     String classId,
                     boolean suppressAuditing,
                     boolean debugAuditing) {

        this.cv = new ClassAdapter(cv);

        this.id = classId;

        this.suppressClass = suppressAuditing;
View Full Code Here

TOP

Related Classes of org.objectweb.asm.ClassAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.