Package org.apache.commons.compress.harmony.unpack200.bytecode

# Class BCIRenumberedAttribute

java.lang.Object
org.apache.commons.compress.harmony.unpack200.bytecode.ClassFileEntry
org.apache.commons.compress.harmony.unpack200.bytecode.Attribute
org.apache.commons.compress.harmony.unpack200.bytecode.BCIRenumberedAttribute

Direct Known Subclasses:
  `CodeAttribute`, `LineNumberTableAttribute`, `LocalVariableTableAttribute`, `LocalVariableTypeTableAttribute`, `NewAttribute`

public abstract class BCIRenumberedAttribute extends Attribute
Abstract superclass for attributes that have some part encoded with Byte Code Injection (BCI) renumbering.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `renumbered`
  Whether renumbering has occurred.

  ### Fields inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.Attribute

  `attributeName`

  ### Fields inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.ClassFileEntry

  `NONE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BCIRenumberedAttribute(CPUTF8 attributeName)`
  Constructs a new instance for an attribute name.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract int`
  `getLength()`
  Gets the length.
  `protected abstract int[]`
  `getStartPCs()`
  Gets the array of indices for the start of line numbers.
  `boolean`
  `hasBCIRenumbering()`
  Answer true if the receiver needs to have BCI renumbering applied to it; otherwise answer false.
  `void`
  `renumber(List<Integer> byteCodeOffsets)`
  In Pack200, line number tables are BCI renumbered.
  `abstract String`
  `toString()`
  `protected abstract void`
  `writeBody(DataOutputStream dos)`
  Writes this body to the given output stream.

  ### Methods inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.Attribute

  `doWrite, equals, getAttributeName, getLengthIncludingHeader, getNestedClassFileEntries, hashCode, isSourceFileAttribute, resolve`

  ### Methods inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.ClassFileEntry

  `objectHashCode, write`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### renumbered

    protected boolean renumbered
    Whether renumbering has occurred.

- ## Constructor Details

  - ### BCIRenumberedAttribute

    public BCIRenumberedAttribute(CPUTF8 attributeName)
    Constructs a new instance for an attribute name.
    Parameters:
      `attributeName` - an attribute name.

- ## Method Details

  - ### getLength

    protected abstract int getLength()
    Description copied from class: `Attribute`
    Gets the length.
    Specified by:
      `getLength` in class `Attribute`
    Returns:
      the length.

  - ### getStartPCs

    protected abstract int[] getStartPCs()
    Gets the array of indices for the start of line numbers.
    Returns:
      the array of indices for the start of line numbers.

  - ### hasBCIRenumbering

    public boolean hasBCIRenumbering()
    Description copied from class: `Attribute`
    Answer true if the receiver needs to have BCI renumbering applied to it; otherwise answer false.
    Overrides:
      `hasBCIRenumbering` in class `Attribute`
    Returns:
      boolean BCI renumbering required

  - ### renumber

    public void renumber(List<Integer> byteCodeOffsets) throws Pack200Exception
    In Pack200, line number tables are BCI renumbered. This method takes the byteCodeOffsets (which is a List of Integers specifying the offset in the byte code array of each instruction) and updates the start_pcs so that it points to the instruction index itself, not the BCI renumbering of the instruction.
    Parameters:
      `byteCodeOffsets` - List of Integer offsets of the byte code array.
    Throws:
      `Pack200Exception` - Thrown from a subclass.

  - ### toString

    public abstract String toString()
    Specified by:
      `toString` in class `ClassFileEntry`

  - ### writeBody

    protected abstract void writeBody(DataOutputStream dos) throws IOException
    Description copied from class: `Attribute`
    Writes this body to the given output stream.
    Specified by:
      `writeBody` in class `Attribute`
    Parameters:
      `dos` - the output stream.
    Throws:
      `IOException` - if an I/O error occurs.