Package org.deuce.objectweb.asm

Examples of org.deuce.objectweb.asm.ClassReader


            System.err.println("Prints a disassembled view of the given class.");
            System.err.println("Usage: TraceClassVisitor [-debug] "
                    + "<fully qualified class name or class file name>");
            return;
        }
        ClassReader cr;
        if (args[i].endsWith(".class") || args[i].indexOf('\\') > -1
                || args[i].indexOf('/') > -1)
        {
            cr = new ClassReader(new FileInputStream(args[i]));
        } else {
            cr = new ClassReader(args[i]);
        }
        cr.accept(new TraceClassVisitor(new PrintWriter(System.out)),
                getDefaultAttributes(),
                flags);
    }
View Full Code Here


            System.err.println("Verifies the given class.");
            System.err.println("Usage: CheckClassAdapter "
                    + "<fully qualified class name or class file name>");
            return;
        }
        ClassReader cr;
        if (args[0].endsWith(".class")) {
            cr = new ClassReader(new FileInputStream(args[0]));
        } else {
            cr = new ClassReader(args[0]);
        }

        verify(cr, false, new PrintWriter(System.err));
    }
View Full Code Here

            System.err.println("Prints the ASM code to generate the given class.");
            System.err.println("Usage: ASMifierClassVisitor [-debug] "
                    + "<fully qualified class name or class file name>");
            return;
        }
        ClassReader cr;
        if (args[i].endsWith(".class") || args[i].indexOf('\\') > -1
                || args[i].indexOf('/') > -1)
        {
            cr = new ClassReader(new FileInputStream(args[i]));
        } else {
            cr = new ClassReader(args[i]);
        }
        cr.accept(new ASMifierClassVisitor(new PrintWriter(System.out)),
                getDefaultAttributes(),
                flags);
    }
View Full Code Here

   
    super.visit(JAVA5_VERSION, access, name, signature, superName, interfaces);
  }
 
  public byte[] visit( byte[] bytes){
    ClassReader cr = new ClassReader(bytes);
    cr.accept(this, 0);
    return ((ClassWriter)super.cv).toByteArray();
  }
View Full Code Here

  }
 
  public byte[] visit( byte[] bytes){   
    //Implementing Phase1 to collect remote Annotated Method Details
    DataCollectorAdaptor da = new DataCollectorAdaptor(rmd);
    ClassReader cr1 = new ClassReader(bytes);
    cr1.accept(da, ClassReader.SKIP_DEBUG);
   
    //Implementing Phase2 to Perform Byte Code Manipulation
    ClassReader cr2 = new ClassReader(bytes);
    cr2.accept((ClassTransformer)this, ClassReader.EXPAND_FRAMES);
   
    //Test & Print the newly implemented class, only if print requested
    String print = System.getProperty("bytecodePrint", "false");
    if(Boolean.parseBoolean(print)){
      ClassReader cr3 = new ClassReader(((ClassWriter)cv).toByteArray());
      ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
      PrintWriter writer = new PrintWriter(System.out);
      CheckClassAdapter cv = new CheckClassAdapter(cw);
      TraceClassVisitor tcv = new TraceClassVisitor(cv, writer );
      cr3.accept(tcv, ClassReader.EXPAND_FRAMES);
      byte[] newFile = cw.toByteArray();
      return newFile;
    }
   
    return ((ClassWriter)super.cv).toByteArray();
View Full Code Here

    String clazz = Integer.class.getName();
   
    ClassTransformer rt = new ClassTransformer(Type.getInternalName(Class.forName(clazz)), new HyClassTransformer(Type.getInternalName(Class.forName(clazz))));
//    HyClassTransformer rt = new HyClassTransformer(Type.getInternalName(Class.forName(clazz)));
//    ClassWriter rt = new ClassWriter(0);
    ClassReader cr = new ClassReader(clazz);
    cr.accept(rt, 0);
    byte[] transformed = rt.getClassWritter().toByteArray()
   
//    Class c = new MyClassLoader().defineClass(clazz, transformed);
//    Object o = c.getConstructor(String.class).newInstance("123");
//    c.getMethod("deposit", int.class).invoke(o, 10);
View Full Code Here

  }
 
  private static void byteCode(byte[]  transformed){
    PrintWriter printWriter = new PrintWriter(System.out);
    TraceClassVisitor tv = new TraceClassVisitor(printWriter);
    ClassReader cr2 = new ClassReader(transformed);
    cr2.accept(tv, 0);
  }
View Full Code Here

  }

  private static void ASMfier(byte[] transformed){
    PrintWriter printWriter = new PrintWriter(System.out);
    ASMifierClassVisitor asm = new ASMifierClassVisitor(printWriter);
    ClassReader cr3 = new ClassReader(transformed);
    cr3.accept(asm, 0);
  }
View Full Code Here

    String[] iF = {"java/rmi/Remote","java/io/Serializable"};
    cw.visit(V1_6, ACC_PUBLIC,className, null,  "java/rmi/server/UnicastRemoteObject",iF);
    ProxyImpl.addCode(remoteDetails, cw, cD);
    cw.visitEnd();
    //Test Generated Class
    ClassReader cr3 = new ClassReader(cw.toByteArray());
    ClassWriter cw1 = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    PrintWriter writer = new PrintWriter(System.out);
    CheckClassAdapter cv = new CheckClassAdapter(cw);
    TraceClassVisitor tcv = new TraceClassVisitor(cv, writer );
    cr3.accept(tcv, ClassReader.EXPAND_FRAMES);
    return cw1.toByteArray();   
  }
View Full Code Here

    cw.visit(V1_6, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, className, null, "java/lang/Object",iF);
    cw.visitSource("$HY$_IBankAccount.java", null);
    ProxyInterface.addCode(remoteDetails, cw)
    cw.visitEnd();
    //Test Generated Class
    ClassReader cr3 = new ClassReader(cw.toByteArray());
    ClassWriter cw1 = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    PrintWriter writer = new PrintWriter(System.out);
    CheckClassAdapter cv = new CheckClassAdapter(cw);
    TraceClassVisitor tcv = new TraceClassVisitor(cv, writer );
    cr3.accept(tcv, ClassReader.EXPAND_FRAMES);
    return cw1.toByteArray();   
  }
View Full Code Here

TOP

Related Classes of org.deuce.objectweb.asm.ClassReader

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.