Class CodeAttrInfo

  • All Implemented Interfaces:
    ClassConstants

    public class CodeAttrInfo
    extends AttrInfo
    Representation of an attribute.
    • Field Detail

      • CONSTANT_FIELD_SIZE

        public static final int CONSTANT_FIELD_SIZE
        The constant CONSTANT_FIELD_SIZE.
        See Also:
        Constant Field Values
      • u2attributesCount

        protected int u2attributesCount
        The attributes count.
      • attributes

        protected AttrInfo[] attributes
        The Attributes.
    • Constructor Detail

      • CodeAttrInfo

        protected CodeAttrInfo​(ClassFile cf,
                               int attrNameIndex,
                               int attrLength)
        Instantiates a new Code attr info.
        Parameters:
        cf - the cf
        attrNameIndex - the attr name index
        attrLength - the attr length
    • Method Detail

      • getAttrInfoLength

        protected int getAttrInfoLength()
        Return the length in bytes of the attribute.
        Overrides:
        getAttrInfoLength in class AttrInfo
        Returns:
        the attr info length
      • getAttrName

        protected java.lang.String getAttrName()
        Return the String name of the attribute; over-ride this in sub-classes.
        Overrides:
        getAttrName in class AttrInfo
        Returns:
        the attr name
      • trimAttrsExcept

        protected void trimAttrsExcept​(java.lang.String[] keepAttrs)
        Trim attributes from the classfile ('Code', 'Exceptions', 'ConstantValue' are preserved, all others except the list in the String[] are killed).
        Overrides:
        trimAttrsExcept in class AttrInfo
        Parameters:
        keepAttrs - the keep attrs
      • markUtf8RefsInInfo

        protected void markUtf8RefsInInfo​(ConstantPool pool)
        Check for references in the 'info' data to the constant pool and mark them.
        Overrides:
        markUtf8RefsInInfo in class AttrInfo
        Parameters:
        pool - the pool
      • readInfo

        protected void readInfo​(java.io.DataInput din)
                         throws java.io.IOException
        Read the data following the header.
        Overrides:
        readInfo in class AttrInfo
        Parameters:
        din - the din
        Throws:
        java.io.IOException - the io exception
      • writeInfo

        public void writeInfo​(java.io.DataOutput dout)
                       throws java.io.IOException
        Export data following the header to a DataOutput stream.
        Overrides:
        writeInfo in class AttrInfo
        Parameters:
        dout - the dout
        Throws:
        java.io.IOException - the io exception