Package org.objectweb.asm

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


                for(Constant c: constants)
                  c.write(cw);
                cr.accept(cw, false);
            }

          bos.write(cw.toByteArray());
          return true;
        } catch (LazyException e) {
          return false;
        }
   }
View Full Code Here


            if (COMPACT_CONSTANTS) {
              Set<Constant> constants = new TreeSet<Constant>(new ConstantComparator());
              constants.addAll(cp.values());

              cr = new ClassReader(cw.toByteArray());
                cw = new ClassWriter(0);
                for(Constant c: constants) {
                  c.write(cw);
                }
                cr.accept(cw, 0);
View Full Code Here

                  c.write(cw);
                }
                cr.accept(cw, 0);
            }

          bos.write(cw.toByteArray());
          return true;
        } catch (TranslatorException te) {
          listener.weavingError(te.getMessage());
          return false;
        } catch (LazyException e) {
View Full Code Here

            if (COMPACT_CONSTANTS) {
              Set<Constant> constants = new TreeSet<Constant>(new ConstantComparator());
              constants.addAll(cp.values());

              cr = new ClassReader(cw.toByteArray());
                cw = new ClassWriter(false);
                for(Constant c: constants)
                  c.write(cw);
                cr.accept(cw, false);
            }
View Full Code Here

                for(Constant c: constants)
                  c.write(cw);
                cr.accept(cw, false);
            }

          bos.write(cw.toByteArray());
          return true;
        } catch (TranslationException te) {
          listener.weavingError(te.getMessage());
          return false;
        } catch (LazyException e) {
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

        }

        // End process
        cw.visitEnd();
        return cw.toByteArray();
    }

    /**
     * Generate on method.
     * @param cw : class writer
View Full Code Here

      }
      FileOutputStream classOutStream = null;
      try {
        //write out the new bytes of the class file
        classOutStream = new FileOutputStream(arg);
        if (writer != null) classOutStream.write(writer.toByteArray());
      } finally {
        //close the OutputStream if it is still around
        if (classOutStream != null) classOutStream.close();
      }
    }
View Full Code Here

                               new WovenProxyAdapter(cWriter, className, loader));
   
    // If we are Java 1.6 + then we need to skip frames as they will be recomputed
    cReader.accept(weavingAdapter, AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ? ClassReader.SKIP_FRAMES : 0);
   
    return cWriter.toByteArray();
  }
}
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.