Package de.fub.bytecode.classfile

Examples of de.fub.bytecode.classfile.JavaClass


  Enumeration classes = _classes.elements();
  final String now = (new Date()).toString();
  final java.util.jar.Attributes.Name dateAttr =
      new java.util.jar.Attributes.Name("Date");
  while (classes.hasMoreElements()) {
      final JavaClass clazz = (JavaClass)classes.nextElement();
      final java.util.jar.Attributes attr =
    new java.util.jar.Attributes();
      attr.put(dateAttr, now);
      map.put(classFileName(clazz.getClassName()), attr);
  }

  final File jarFile = new File(_destDir, jarFileName+".jar");
  final JarOutputStream jos =
      new JarOutputStream(new FileOutputStream(jarFile), manifest);
  classes = _classes.elements();
  while (classes.hasMoreElements()) {
      final JavaClass cl = (JavaClass)classes.nextElement();
      jos.putNextEntry(new JarEntry(classFileName(cl.getClassName())));
      final ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
      cl.dump(out)// dump() closes it's output stream
      out.writeTo(jos);
  }
  jos.close();
    }
View Full Code Here


  Enumeration classes = _classes.elements();
  final String now = (new Date()).toString();
  final java.util.jar.Attributes.Name dateAttr =
      new java.util.jar.Attributes.Name("Date");
  while (classes.hasMoreElements()) {
      final JavaClass clazz = (JavaClass)classes.nextElement();
      final String className = clazz.getClassName().replace('.','/');
      final java.util.jar.Attributes attr = new java.util.jar.Attributes();
      attr.put(dateAttr, now);
      map.put(className+".class", attr);
  }

  final File jarFile = new File(_destDir, _jarFileName);
  final JarOutputStream jos =
      new JarOutputStream(new FileOutputStream(jarFile), manifest);
  classes = _classes.elements();
  while (classes.hasMoreElements()) {
      final JavaClass clazz = (JavaClass)classes.nextElement();
      final String className = clazz.getClassName().replace('.','/');
      jos.putNextEntry(new JarEntry(className+".class"));
      final ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
      clazz.dump(out); // dump() closes it's output stream
      out.writeTo(jos);
  }
  jos.close();
    }
View Full Code Here

TOP

Related Classes of de.fub.bytecode.classfile.JavaClass

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.