com.sun.tools.classfile
Class ClassWriter

java.lang.Object
  extended by com.sun.tools.classfile.ClassWriter

public class ClassWriter
extends java.lang.Object

Write a ClassFile data structure to a file or stream.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Nested Class Summary
protected static class ClassWriter.AnnotationWriter
          Writer for annotations and the values they contain.
protected static class ClassWriter.AttributeWriter
          Writer for the different types of attribute.
protected static class ClassWriter.ClassOutputStream
          Subtype of ByteArrayOutputStream with the convenience methods of a DataOutputStream.
protected static class ClassWriter.ConstantPoolWriter
          Writer for the entries in the constant pool.
protected static class ClassWriter.StackMapTableWriter
          Writer for the frames of StackMap and StackMapTable attributes.
 
Field Summary
protected  ClassWriter.AttributeWriter attributeWriter
           
protected  ClassFile classFile
           
protected  ClassWriter.ConstantPoolWriter constantPoolWriter
           
protected  ClassWriter.ClassOutputStream out
           
 
Constructor Summary
ClassWriter()
           
 
Method Summary
protected  void write()
           
 void write(ClassFile classFile, java.io.File f)
          Write a ClassFile data structure to a file.
 void write(ClassFile classFile, java.io.OutputStream s)
          Write a ClassFile data structure to a stream.
protected  void writeAccessFlags(AccessFlags flags)
           
protected  void writeAttributes(Attributes attributes)
           
protected  void writeClassInfo()
           
protected  void writeConstantPool()
           
protected  void writeDescriptor(Descriptor d)
           
protected  void writeField(Field f)
           
protected  void writeFields()
           
protected  void writeHeader()
           
protected  void writeMethod(Method m)
           
protected  void writeMethods()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classFile

protected ClassFile classFile

out

protected ClassWriter.ClassOutputStream out

attributeWriter

protected ClassWriter.AttributeWriter attributeWriter

constantPoolWriter

protected ClassWriter.ConstantPoolWriter constantPoolWriter
Constructor Detail

ClassWriter

public ClassWriter()
Method Detail

write

public void write(ClassFile classFile,
                  java.io.File f)
           throws java.io.IOException
Write a ClassFile data structure to a file.

Throws:
java.io.IOException

write

public void write(ClassFile classFile,
                  java.io.OutputStream s)
           throws java.io.IOException
Write a ClassFile data structure to a stream.

Throws:
java.io.IOException

write

protected void write()
              throws java.io.IOException
Throws:
java.io.IOException

writeHeader

protected void writeHeader()

writeAccessFlags

protected void writeAccessFlags(AccessFlags flags)

writeAttributes

protected void writeAttributes(Attributes attributes)

writeClassInfo

protected void writeClassInfo()

writeDescriptor

protected void writeDescriptor(Descriptor d)

writeConstantPool

protected void writeConstantPool()

writeFields

protected void writeFields()
                    throws java.io.IOException
Throws:
java.io.IOException

writeField

protected void writeField(Field f)
                   throws java.io.IOException
Throws:
java.io.IOException

writeMethods

protected void writeMethods()
                     throws java.io.IOException
Throws:
java.io.IOException

writeMethod

protected void writeMethod(Method m)
                    throws java.io.IOException
Throws:
java.io.IOException