Package org.objectweb.asm

Examples of org.objectweb.asm.ClassWriter.toByteArray()


                generateMethod(cw, interfaceName, className, method, consumes, produces);
            }
        }
        cw.visitEnd();

        return cw.toByteArray();
    }

    // public <ReturnType> method(<Type0> arg0, ..., <TypeN> argN) throws <ExpectionType0>, ..., <ExceptionTypeK>
    private static void generateMethod(ClassWriter cw,
                                       String interfaceName,
View Full Code Here


            generateMessagePart(cw, mpi, method, classFileName);
        }

        cw.visitEnd();

        Class<?> clz = loadClass(className, method.getDeclaringClass(), cw.toByteArray());
        wrapperPart.setTypeClass(clz);
        wrapperBeans.add(clz);
    }

    private void generatePackageInfo(String className, String ns, Class clz) {
View Full Code Here

                      getClassCode(XmlNsForm.class),
                      q ? "QUALIFIED" : "UNQUALIFIED");
        av0.visitEnd();
        cw.visitEnd();

        loadClass(className, clz, cw.toByteArray());
    }

    private void generateMessagePart(ClassWriter cw, MessagePartInfo mpi, Method method, String className) {
        if (Boolean.TRUE.equals(mpi.getProperty(ReflectionServiceFactoryBean.HEADER))) {
            return;
View Full Code Here

   
    assertEquals("", ClassUtil.verifyClass(cw));
   
    classStream.close();
   
    return new ClassReader(cw.toByteArray());
  }
}
View Full Code Here

        catch ( Throwable e )
        {
            throw new GeneratorException( "ASM issue processing class-file " + helpClassFile.getPath(), e );
        }

        byte[] renamedClass = cw.toByteArray();
        FileOutputStream fos = null;
        try
        {
            fos = new FileOutputStream( rewriteHelpClassFile );
            fos.write( renamedClass );
View Full Code Here

          org.objectweb.asm.commons.Method.getMethod("double bar()"), null, null, classWriter);
      gen.push(2.0);
      gen.returnValue();
      gen.endMethod();     
     
      byte[] bc = classWriter.toByteArray();
      return defineClass(className, bc, 0, bc.length);
    }
  }
 
  /** uses this test with a different classloader and tries to
View Full Code Here

        if (DUMP) {
            try {
                LoggerFactory.getLogger(getClass()).debug(
                        "Dumping generated overload dispatcher class for PE of class [" + targetClass + "]");
                Files.write(cw.toByteArray(), new File(System.getProperty("java.io.tmpdir") + "/" + dispatcherClassName
                        + ".class"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return new OverloadDispatcherClassLoader(targetClass.getClassLoader()).loadClassFromBytes(dispatcherClassName,
                cw.toByteArray());

    }

    private void generateEventDispatchMethod(ClassWriter cw, String dispatchMethodName,
            List<Hierarchy> eventHierarchies, String processEventMethodName) {
View Full Code Here

    if (this.implement(cn))
    {
      System.out.println("Adding runtime interfaces to " + transformedName);
      ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
      cn.accept(cw);
      bytes = cw.toByteArray();
      cr = new ClassReader(bytes);
    }

    workingPath.remove(workingPath.size() - 1);
View Full Code Here

    mv.visitFieldInsn(Opcodes.PUTFIELD, name, names[4], "Lnet/minecraft/logging/ILogAgent;");
    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(11, 10);
    mv.visitEnd();
    cw.visitEnd();
    return cw.toByteArray();
  }

  private byte[] writeWorldServer(String name, String transformedName, byte[] bytes, ClassReader cr)
  {
    String[] names = null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.