Class Attribute

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected CPUTF8 attributeName
      The attribute name.
      • Fields inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.ClassFileEntry

        NONE
    • Constructor Summary

      Constructors 
      Constructor Description
      Attribute​(CPUTF8 attributeName)
      Constructs a new instance for an attribute name.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doWrite​(java.io.DataOutputStream dos)
      Writes this instance to the output stream.
      boolean equals​(java.lang.Object obj)  
      protected CPUTF8 getAttributeName()
      Gets the attribute name.
      protected abstract int getLength()
      Gets the length.
      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).
      protected ClassFileEntry[] getNestedClassFileEntries()
      Returns an empty array.
      boolean hasBCIRenumbering()
      Answer true if the receiver needs to have BCI renumbering applied to it; otherwise answer false.
      int hashCode()  
      boolean isSourceFileAttribute()
      Answer true if the receiver is a source file attribute (which gets special handling when the class is built); otherwise answer false.
      protected void resolve​(ClassConstantPool pool)
      Allows the constant pool entries to resolve their nested entries.
      protected abstract void writeBody​(java.io.DataOutputStream out)
      Writes this body to the given output stream.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Attribute

        public Attribute​(CPUTF8 attributeName)
        Constructs a new instance for an attribute name.
        Parameters:
        attributeName - an attribute name.
    • Method Detail

      • doWrite

        protected void doWrite​(java.io.DataOutputStream dos)
                        throws java.io.IOException
        Description copied from class: ClassFileEntry
        Writes this instance to the output stream.
        Specified by:
        doWrite in class ClassFileEntry
        Parameters:
        dos - the output stream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getAttributeName

        protected CPUTF8 getAttributeName()
        Gets the attribute name.
        Returns:
        the attribute name.
      • getLength

        protected abstract int getLength()
        Gets the length.
        Returns:
        the length.
      • 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
      • 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
      • 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
      • writeBody

        protected abstract void writeBody​(java.io.DataOutputStream out)
                                   throws java.io.IOException
        Writes this body to the given output stream.
        Parameters:
        out - the output stream.
        Throws:
        java.io.IOException - if an I/O error occurs.