ProGuard

proguard.classfile
Class AttrInfo

java.lang.Object
  extended byproguard.classfile.AttrInfo
All Implemented Interfaces:
VisitorAccepter
Direct Known Subclasses:
CodeAttrInfo, ConstantValueAttrInfo, DeprecatedAttrInfo, ExceptionsAttrInfo, InnerClassesAttrInfo, LineNumberTableAttrInfo, LocalVariableTableAttrInfo, SignatureAttrInfo, SourceDirAttrInfo, SourceFileAttrInfo, SyntheticAttrInfo, UnknownAttrInfo

public abstract class AttrInfo
extends Object
implements VisitorAccepter

Representation of an attribute. Specific attributes have their representations sub-classed from this.


Field Summary
protected static int CONSTANT_FIELD_SIZE
           
 int u2attrNameIndex
           
 Object visitorInfo
          An extra field in which visitors can store information.
 
Constructor Summary
protected AttrInfo()
           
 
Method Summary
 void accept(ClassFile classFile, AttrInfoVisitor attrInfoVisitor)
          Accepts the given visitor.
 void accept(ClassFile classFile, FieldInfo fieldInfo, AttrInfoVisitor attrInfoVisitor)
          Accepts the given visitor in the context of a field.
 void accept(ClassFile classFile, MethodInfo methodInfo, AttrInfoVisitor attrInfoVisitor)
          Accepts the given visitor in the context of a method.
 void accept(ClassFile classFile, MethodInfo methodInfo, CodeAttrInfo codeAttrInfo, AttrInfoVisitor attrInfoVisitor)
          Accepts the given visitor in the context of a method's code.
static AttrInfo create(DataInput din, ClassFile cf)
          Creates a new AttrInfo from the data passed.
 String getAttributeName(ClassFile classFile)
          Returns the String name of the attribute; over-ride this in sub-classes.
protected abstract  int getAttrInfoLength()
          Returns the length in bytes of the attribute.
 Object getVisitorInfo()
          Gets the visitor information of the visitor accepter.
protected abstract  void readInfo(DataInput din, ClassFile cf)
          Reads the data following the header.
 void setVisitorInfo(Object visitorInfo)
          Sets the visitor information of the visitor accepter.
 void write(DataOutput dout)
          Exports the representation to a DataOutput stream.
protected abstract  void writeInfo(DataOutput dout)
          Exports data following the header to a DataOutput stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_FIELD_SIZE

protected static final int CONSTANT_FIELD_SIZE
See Also:
Constant Field Values

u2attrNameIndex

public int u2attrNameIndex

visitorInfo

public Object visitorInfo
An extra field in which visitors can store information.

Constructor Detail

AttrInfo

protected AttrInfo()
Method Detail

create

public static AttrInfo create(DataInput din,
                              ClassFile cf)
                       throws IOException
Creates a new AttrInfo from the data passed.

Throws:
IOException - if class file is corrupt or incomplete

write

public final void write(DataOutput dout)
                 throws IOException
Exports the representation to a DataOutput stream.

Throws:
IOException

getAttributeName

public String getAttributeName(ClassFile classFile)
Returns the String name of the attribute; over-ride this in sub-classes.


getAttrInfoLength

protected abstract int getAttrInfoLength()
Returns the length in bytes of the attribute.


readInfo

protected abstract void readInfo(DataInput din,
                                 ClassFile cf)
                          throws IOException
Reads the data following the header.

Throws:
IOException

writeInfo

protected abstract void writeInfo(DataOutput dout)
                           throws IOException
Exports data following the header to a DataOutput stream.

Throws:
IOException

accept

public void accept(ClassFile classFile,
                   AttrInfoVisitor attrInfoVisitor)
Accepts the given visitor. This default implementation does nothing, which is useful for attributes that require a context.


accept

public void accept(ClassFile classFile,
                   FieldInfo fieldInfo,
                   AttrInfoVisitor attrInfoVisitor)
Accepts the given visitor in the context of a field. This default implementation ignores the context.


accept

public void accept(ClassFile classFile,
                   MethodInfo methodInfo,
                   AttrInfoVisitor attrInfoVisitor)
Accepts the given visitor in the context of a method. This default implementation ignores the context.


accept

public void accept(ClassFile classFile,
                   MethodInfo methodInfo,
                   CodeAttrInfo codeAttrInfo,
                   AttrInfoVisitor attrInfoVisitor)
Accepts the given visitor in the context of a method's code. This default implementation ignores the code.


getVisitorInfo

public Object getVisitorInfo()
Description copied from interface: VisitorAccepter
Gets the visitor information of the visitor accepter.

Specified by:
getVisitorInfo in interface VisitorAccepter

setVisitorInfo

public void setVisitorInfo(Object visitorInfo)
Description copied from interface: VisitorAccepter
Sets the visitor information of the visitor accepter.

Specified by:
setVisitorInfo in interface VisitorAccepter

ProGuard