Class Attribute
- java.lang.Object
-
- kala.compress.harmony.unpack200.bytecode.ClassFileEntry
-
- kala.compress.harmony.unpack200.bytecode.Attribute
-
- Direct Known Subclasses:
AnnotationsAttribute,BCIRenumberedAttribute,ConstantValueAttribute,DeprecatedAttribute,EnclosingMethodAttribute,ExceptionsAttribute,InnerClassesAttribute,SignatureAttribute,SourceFileAttribute
public abstract class Attribute extends ClassFileEntry
Abstract superclass for class file attributes
-
-
Field Summary
Fields Modifier and Type Field Description protected CPUTF8attributeNameprivate intattributeNameIndex-
Fields inherited from class kala.compress.harmony.unpack200.bytecode.ClassFileEntry
NONE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoWrite(java.io.DataOutputStream dos)booleanequals(java.lang.Object obj)protected CPUTF8getAttributeName()protected abstract intgetLength()protected intgetLengthIncludingHeader()Answer the length of the receiver including its header (the u2 for the attribute name and the u4 for the attribute length).protected ClassFileEntry[]getNestedClassFileEntries()booleanhasBCIRenumbering()Answer true if the receiver needs to have BCI renumbering applied to it; otherwise answer false.inthashCode()booleanisSourceFileAttribute()Answer true if the receiver is a source file attribute (which gets special handling when the class is built); otherwise answer false.protected voidresolve(ClassConstantPool pool)Allows the constant pool entries to resolve their nested entries.protected abstract voidwriteBody(java.io.DataOutputStream dos)-
Methods inherited from class kala.compress.harmony.unpack200.bytecode.ClassFileEntry
objectHashCode, toString, write
-
-
-
-
Field Detail
-
attributeName
protected final CPUTF8 attributeName
-
attributeNameIndex
private int attributeNameIndex
-
-
Constructor Detail
-
Attribute
public Attribute(CPUTF8 attributeName)
-
-
Method Detail
-
doWrite
protected void doWrite(java.io.DataOutputStream dos) throws java.io.IOException- Specified by:
doWritein classClassFileEntry- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin classClassFileEntry
-
getAttributeName
protected CPUTF8 getAttributeName()
-
getLength
protected abstract int getLength()
-
getLengthIncludingHeader
protected int getLengthIncludingHeader()
Answer the length of the receiver including its header (the u2 for the attribute name and the u4 for the attribute length). This is relevant when attributes are nested within other attributes - the outer attribute needs to take the inner attribute headers into account when calculating its length.- Returns:
- int adjusted length
-
getNestedClassFileEntries
protected ClassFileEntry[] getNestedClassFileEntries()
- Overrides:
getNestedClassFileEntriesin classClassFileEntry
-
hasBCIRenumbering
public boolean hasBCIRenumbering()
Answer true if the receiver needs to have BCI renumbering applied to it; otherwise answer false.- Returns:
- boolean BCI renumbering required
-
hashCode
public int hashCode()
- Specified by:
hashCodein classClassFileEntry
-
isSourceFileAttribute
public boolean isSourceFileAttribute()
Answer true if the receiver is a source file attribute (which gets special handling when the class is built); otherwise answer false.- Returns:
- boolean source file attribute
-
resolve
protected void resolve(ClassConstantPool pool)
Description copied from class:ClassFileEntryAllows the constant pool entries to resolve their nested entries.- Overrides:
resolvein classClassFileEntry- Parameters:
pool- TODO
-
writeBody
protected abstract void writeBody(java.io.DataOutputStream dos) throws java.io.IOException- Throws:
java.io.IOException
-
-