public class CfField extends CfFieldOrMethod implements AttributeHandler
Fields are organized into a linked list within our ClassFile, rather than an array, to allow for efficient dynamic growth.
Modifier and Type | Method and Description |
---|---|
CpEntry |
getConstantValue() |
CfField |
getNext() |
CpRef |
getRef()
Return a Cp(Method)Ref for invoking this method.
|
boolean |
handleAttribute(java.io.DataInputStream dataIn,
java.lang.String name,
int length)
For fields we must recognize: ConstantValue, Synthetic, Deprecated.
|
void |
read(java.io.DataInputStream dataIn)
Read the member from the given stream, overwriting any previous values.
|
void |
setConstantValue(CpEntry constantValue) |
void |
setNext(CfField next) |
void |
write(java.io.DataOutput dout)
Write the field or method to a stream in JVM classfile format.
|
getClassFile, getConstantPool, getDescriptorIndex, getName, getNameIndex, getSignature, isSynthetic, setDescriptorIndex, setNameIndex, setSynthetic
getAccessFlags, getAttributeCount, getAttributes, isAbstract, isDeprecated, isFinal, isInterface, isNative, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, setAbstract, setAccessFlags, setAttributes, setDeprecated, setFinal, setInterface, setNative, setPrivate, setProtected, setPublic, setStatic, setStrict, setSynchronized, setTransient, setVolatile
public CfField(ClassFile classFile)
classFile
- public CfField getNext()
public void setNext(CfField next)
public CpEntry getConstantValue()
public void setConstantValue(CpEntry constantValue)
public void read(java.io.DataInputStream dataIn) throws java.io.IOException, ClassFileFormatException
CfFieldOrMethod
Subclasses must override this method, first invoking this one, and then processing attributes.
field_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2 attributes_count; attribute_info attributes[attributes_count]; } method_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2 attributes_count; attribute_info attributes[attributes_count]; }
read
in class CfFieldOrMethod
java.io.IOException
ClassFileFormatException
public boolean handleAttribute(java.io.DataInputStream dataIn, java.lang.String name, int length) throws java.io.IOException, ClassFileFormatException
handleAttribute
in interface AttributeHandler
dataIn
- DataInputStream, positioned to attribute's data.name
- Attribute name from constant pool.length
- Length of info[] in bytes.java.io.IOException
- If an I/O error ocurrs.ClassFileFormatException
- If the attribute was processed but
was incorrectly formed.public void write(java.io.DataOutput dout) throws java.io.IOException
CfFieldOrMethod
Subclasses must override this and extend the behavior by writing the attribute table.
write
in class CfFieldOrMethod
java.io.IOException
public CpRef getRef()
Copyright ? 2000-2003 Clarity Systems Group, LLC. All Rights Reserved.