Overview | Package | Class | Tree | Deprecated | Index | Help
| ej-technologies
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gjt.jclasslib.structures
Class AttributeInfo

    java.lang.Object
      org.gjt.jclasslib.structures.AbstractStructure
          org.gjt.jclasslib.structures.AbstractStructureWithAttributes
              org.gjt.jclasslib.structures.AttributeInfo

Direct Known Subclasses:
  AnnotationDefaultAttribute, CodeAttribute, ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute, ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute, LocalVariableCommonAttribute, RuntimeAnnotationsAttribute, SignatureAttribute, SourceFileAttribute, SyntheticAttribute

public class AttributeInfo
extends AbstractStructureWithAttributes

Base class for all attribute structures in the `attribute` package.

Version:
  $Revision: 1.6 $ $Date: 2004/12/28 13:04:32 $
Author:
  Ingo Kegel, Vitor Carreira

Field Summary
`static String` | `SYSTEM_PROPERTY_SKIP_ATTRIBUTES` Set this JVM System property to true to skip reading of all attributes.

Fields inherited from class org.gjt.jclasslib.structures.AbstractStructureWithAttributes
`attributes`

Fields inherited from class org.gjt.jclasslib.structures.AbstractStructure
`classFile, debug, SYSTEM_PROPERTY_DEBUG`

Constructor Summary
`protected` | `AttributeInfo()` Constructor.

Method Summary
`static AttributeInfo` | `createOrSkip(DataInput in, ClassFile classFile)` Factory method for creating `AttributeInfo` structures.
`int` | `getAttributeLength()` Get the length of this attribute as a number of bytes.
`int` | `getAttributeNameIndex()` Get the constant pool index for the name of the attribute.
`byte[]` | `getInfo()` Get the raw bytes of the attribute.
`String` | `getName()` Get the name of the attribute.
`protected String` | `printAccessFlagsVerbose(int accessFlags)` Utility method for derived structures.
`void` | `read(DataInput in)` Read this structure from the given `DataInput`.
`void` | `setAttributeNameIndex(int attributeNameIndex)` Set the constant pool index for the name of the attribute.
`void` | `setInfo(byte[] info)` Set the raw bytes of the attribute.
`void` | `write(DataOutput out)` Write this structure to the given `DataOutput`.

Methods inherited from class org.gjt.jclasslib.structures.AbstractStructureWithAttributes
`findAttribute, getAttributes, getTotalAttributesLength, readAttributes, setAttributes, writeAttributes`

Methods inherited from class org.gjt.jclasslib.structures.AbstractStructure
`debug, getClassFile, getDebug, getLength, printAccessFlags, printAccessFlagsVerbose, printBytes, setClassFile, setDebug`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SYSTEM_PROPERTY_SKIP_ATTRIBUTES

    public static final String SYSTEM_PROPERTY_SKIP_ATTRIBUTES

  Set this JVM System property to true to skip reading of all attributes. Some class file operations may fail in this case.

  See Also:
    Constant Field Values

Constructor Detail

### AttributeInfo

    protected AttributeInfo()

  Constructor.

Method Detail

### createOrSkip

    public static AttributeInfo createOrSkip(DataInput in,
                                             ClassFile classFile)
                                      throws InvalidByteCodeException,
                                             IOException

  Factory method for creating `AttributeInfo` structures.

  An `AttributeInfo` of the appropriate subtype from the `attributes` package is created unless the type of the attribute is unknown in which case an instance of `AttributeInfo` is returned.

  Attributes are skipped if the environment variable `SYSTEM_PROPERTY_SKIP_ATTRIBUTES` is set to true.

  Parameters:
    `in` - the `DataInput` from which to read the `AttributeInfo` structure
    `classFile` - the parent class file of the structure to be created
  Returns:
    the new `AttributeInfo` structure
  Throws:
    `InvalidByteCodeException` - if the byte code is invalid
    `IOException` - if an exception occurs with the `DataInput`

### getAttributeNameIndex

    public int getAttributeNameIndex()

  Get the constant pool index for the name of the attribute.

  Returns:
    the index

### setAttributeNameIndex

    public void setAttributeNameIndex(int attributeNameIndex)

  Set the constant pool index for the name of the attribute.

  Parameters:
    `attributeNameIndex` - the new index

### getInfo

    public byte[] getInfo()

  Get the raw bytes of the attribute.

  Is non-null only if attribute is of unknown type.

  Returns:
    the byte array

### setInfo

    public void setInfo(byte[] info)

  Set the raw bytes of the attribute.

  Works only if attribute is an instance of `AttributeInfo`.

  Parameters:
    `info` - the new byte array

### getName

    public String getName()
                   throws InvalidByteCodeException

  Get the name of the attribute.

  Returns:
    the name
  Throws:
    `InvalidByteCodeException` - if the byte code is invalid

### read

    public void read(DataInput in)
              throws InvalidByteCodeException,
                     IOException

  Description copied from class: `AbstractStructure`
  Read this structure from the given `DataInput`.

  Excpects `DataInput` to be in JVM class file format and just before a structure of this kind. No look ahead parsing since the class file format is deterministic.

  Overrides:
    `read` in class `AbstractStructure`
  Parameters:
    `in` - the `DataInput` from which to read
  Throws:
    `IOException` - if an exception occurs with the `DataInput`
    `InvalidByteCodeException` - if the byte code is invalid

### write

    public void write(DataOutput out)
               throws InvalidByteCodeException,
                      IOException

  Description copied from class: `AbstractStructure`
  Write this structure to the given `DataOutput`.

  The written bytes are in JVM class file format.

  Overrides:
    `write` in class `AbstractStructure`
  Parameters:
    `out` - the `DataOutput` to which to write
  Throws:
    `IOException` - if an exception occurs with the `DataOutput`
    `InvalidByteCodeException` - if the structure is internally inconsistent

### getAttributeLength

    public int getAttributeLength()

  Get the length of this attribute as a number of bytes.

  Returns:
    the length

### printAccessFlagsVerbose

    protected String printAccessFlagsVerbose(int accessFlags)

  Description copied from class: `AbstractStructure`
  Utility method for derived structures. Print an access flag as a space separated list of verbose java access modifiers.

  Specified by:
    `printAccessFlagsVerbose` in class `AbstractStructure`
  Parameters:
    `accessFlags` - the unsigned short value to print as a hex string
  Returns:
    the hex string

Overview | Package | Class | Tree | Deprecated | Index | Help
| ej-technologies
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD