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

## Class ByteCodeForm

- java.lang.Object
- - org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm

- Direct Known Subclasses:
    ByteForm, IincForm, LabelForm, LocalForm, NoArgumentForm, ReferenceForm, ShortForm, VariableInstructionForm

      public abstract class ByteCodeForm
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static ByteCodeForm[]` | `byteCodeArray`
    `protected static Map` | `byteCodesByName`
    `protected static boolean` | `WIDENED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteCodeForm(int opcode, String name)` Answer a new instance of this class with the specified opcode and name.
    `ByteCodeForm(int opcode, String name, int[] rewrite)` Answer a new instance of this class with the specified opcode, name, operandType and rewrite

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `calculateOperandPosition()`
    `int` | `firstOperandIndex()`
    `void` | `fixUpByteCodeTargets(ByteCode byteCode, CodeAttribute codeAttribute)` The ByteCodeForm knows how to fix up a bytecode if it needs to be fixed up because it holds a Label bytecode.
    `static ByteCodeForm` | `get(int opcode)`
    `String` | `getName()`
    `int` | `getOpcode()`
    `int[]` | `getRewrite()`
    `int[]` | `getRewriteCopy()`
    `boolean` | `hasMultipleByteCodes()` This method will answer true if the receiver is a multi-bytecode instruction (such as aload0_putfield_super); otherwise, it will answer false.
    `boolean` | `hasNoOperand()`
    `boolean` | `nestedMustStartClassPool()`
    `int` | `operandLength()`
    `abstract void` | `setByteCodeOperands(ByteCode byteCode, OperandManager operandManager, int codeLength)` When passed a byteCode, an OperandTable and a SegmentConstantPool, this method will set the rewrite of the byteCode appropriately.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### WIDENED

          protected static final boolean WIDENED

      See Also:
        Constant Field Values

    - #### byteCodeArray

          protected static final ByteCodeForm[] byteCodeArray

    - #### byteCodesByName

          protected static final Map byteCodesByName

  - ### Constructor Detail

    - #### ByteCodeForm

          public ByteCodeForm(int opcode,
                              String name)

      Answer a new instance of this class with the specified opcode and name. Assume no rewrite.
      Parameters:
        `opcode` - int corresponding to the opcode's value
        `name` - String printable name of the opcode

    - #### ByteCodeForm

          public ByteCodeForm(int opcode,
                              String name,
                              int[] rewrite)

      Answer a new instance of this class with the specified opcode, name, operandType and rewrite
      Parameters:
        `opcode` - int corresponding to the opcode's value
        `name` - String printable name of the opcode
        `rewrite` - int[] Array of ints. Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.

  - ### Method Detail

    - #### calculateOperandPosition

          protected void calculateOperandPosition()

    - #### get

          public static ByteCodeForm get(int opcode)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getOpcode

          public int getOpcode()

    - #### getName

          public String getName()

    - #### getRewrite

          public int[] getRewrite()

    - #### getRewriteCopy

          public int[] getRewriteCopy()

    - #### firstOperandIndex

          public int firstOperandIndex()

    - #### operandLength

          public int operandLength()

    - #### hasNoOperand

          public boolean hasNoOperand()

    - #### hasMultipleByteCodes

          public boolean hasMultipleByteCodes()

      This method will answer true if the receiver is a multi-bytecode instruction (such as aload0_putfield_super); otherwise, it will answer false.
      Returns:
        boolean true if multibytecode, false otherwise

    - #### setByteCodeOperands

          public abstract void setByteCodeOperands(ByteCode byteCode,
                                                   OperandManager operandManager,
                                                   int codeLength)

      When passed a byteCode, an OperandTable and a SegmentConstantPool, this method will set the rewrite of the byteCode appropriately.
      Parameters:
        `byteCode` - ByteCode to be updated (!)
        `operandManager` - OperandTable from which to draw info
        `codeLength` - Length of bytes (excluding this bytecode) from the beginning of the method. Used in calculating padding for some variable-length bytecodes (such as lookupswitch, tableswitch).

    - #### fixUpByteCodeTargets

          public void fixUpByteCodeTargets(ByteCode byteCode,
                                           CodeAttribute codeAttribute)

      The ByteCodeForm knows how to fix up a bytecode if it needs to be fixed up because it holds a Label bytecode.
      Parameters:
        `byteCode` - a ByteCode to be fixed up
        `codeAttribute` - a CodeAttribute used to determine how the ByteCode should be fixed up.

    - #### nestedMustStartClassPool

          public boolean nestedMustStartClassPool()

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.