Class AttrInfo

    • Field Detail

      • CONSTANT_FIELD_SIZE

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

        protected int u4attrLength
        The length of the attribute in bytes.
      • owner

        protected ClassFile owner
        The Owner.
    • Constructor Detail

      • AttrInfo

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

      • create

        public static AttrInfo create​(java.io.DataInput din,
                                      ClassFile cf)
                               throws java.io.IOException
        Create a new AttrInfo from the data passed.
        Parameters:
        din - the din
        cf - the cf
        Returns:
        the attr info
        Throws:
        java.io.IOException - if class file is corrupt or incomplete
      • getAttrNameIndex

        protected int getAttrNameIndex()
        Get attr name index int.
        Returns:
        the int
      • getAttrInfoLength

        protected int getAttrInfoLength()
        Return the length of the attribute in bytes; over-ride this in sub-classes.
        Returns:
        the attr info length
      • getAttrName

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

        protected void trimAttrsExcept​(java.lang.String[] keepAttrs)
        Trim attributes from the classfile except those in the String[].
        Parameters:
        keepAttrs - the keep attrs
      • markUtf8Refs

        protected void markUtf8Refs​(ConstantPool pool)
        Check for Utf8 references to constant pool and mark them.
        Parameters:
        pool - the pool
      • markUtf8RefsInInfo

        protected void markUtf8RefsInInfo​(ConstantPool pool)
        Check for Utf8 references in the 'info' data to the constant pool and mark them; over-ride this in sub-classes.
        Parameters:
        pool - the pool
      • readInfo

        protected void readInfo​(java.io.DataInput din)
                         throws java.io.IOException
        Read the data following the header; over-ride this in sub-classes.
        Parameters:
        din - the din
        Throws:
        java.io.IOException - the io exception
      • write

        public final void write​(java.io.DataOutput dout)
                         throws java.io.IOException
        Export the representation to a DataOutput stream.
        Parameters:
        dout - the dout
        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; over-ride this in sub-classes.
        Parameters:
        dout - the dout
        Throws:
        java.io.IOException - the io exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object