Top Fields Constructors Methods
org.apache.commons.compress.harmony.unpack200.bytecode.forms

public abstract Class ByteCodeForm

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.IincForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.LabelForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.LocalForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.NoArgumentForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.ReferenceForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.ShortForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.VariableInstructionForm
Imports
java.util.Arrays, .HashMap, .Map, org.apache.commons.compress.harmony.unpack200.bytecode.ByteCode, .CodeAttribute, .OperandManager

Field Summary

Modifier and TypeField and Description
protected static final ByteCodeForm[]
protected static final Map<String, ByteCodeForm>
private int
private final String
private final int
private int
private final int[]
protected static final boolean

Constructor Summary

AccessConstructor and Description
public
ByteCodeForm(final int
int corresponding to the opcode's value
opcode
,
final String
String printable name of the opcode
name
)

Answer a new instance of this class with the specified opcode and name.

public
ByteCodeForm(final int
int corresponding to the opcode's value
opcode
,
final String
String printable name of the opcode
name
,
final int[]
int[] Array of ints. Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.
rewrite
)

Answer a new instance of this class with the specified opcode, name, operandType and rewrite

Method Summary

Modifier and TypeMethod and Description
protected void
public int
public void
fixUpByteCodeTargets(final ByteCode
a ByteCode to be fixed up
byteCode
,
final CodeAttribute
a CodeAttribute used to determine how the ByteCode should be fixed up.
codeAttribute
)

The ByteCodeForm knows how to fix up a bytecode if it needs to be fixed up because it holds a Label bytecode.

public static ByteCodeForm
get(final int opcode)

public String
public int
public int[]
public int[]
public boolean

Returns:

boolean true if multibytecode, false otherwise
hasMultipleByteCodes
()

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

public boolean
public boolean
public int
public abstract void
setByteCodeOperands(ByteCode
ByteCode to be updated (!)
byteCode
,
OperandManager
OperandTable from which to draw info
operandManager
,
int
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).
codeLength
)

When passed a byteCode, an OperandTable and a SegmentConstantPool, this method will set the rewrite of the byteCode appropriately.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

byteCodeArrayback to summary
protected static final ByteCodeForm[] byteCodeArray
byteCodesByNameback to summary
protected static final Map<String, ByteCodeForm> byteCodesByName
firstOperandIndexback to summary
private int firstOperandIndex
nameback to summary
private final String name
opcodeback to summary
private final int opcode
operandLengthback to summary
private int operandLength
rewriteback to summary
private final int[] rewrite
WIDENEDback to summary
protected static final boolean WIDENED

Constructor Detail

ByteCodeFormback to summary
public ByteCodeForm(final int opcode, final String name)

Answer a new instance of this class with the specified opcode and name. Assume no rewrite.

Parameters
opcode:int

int corresponding to the opcode's value

name:String

String printable name of the opcode

ByteCodeFormback to summary
public ByteCodeForm(final int opcode, final String name, final int[] rewrite)

Answer a new instance of this class with the specified opcode, name, operandType and rewrite

Parameters
opcode:int

int corresponding to the opcode's value

name:String

String printable name of the opcode

rewrite:int[]

int[] Array of ints. Operand positions (which will later be rewritten in ByteCodes) are indicated by -1.

Method Detail

calculateOperandPositionback to summary
protected void calculateOperandPosition()
firstOperandIndexback to summary
public int firstOperandIndex()
fixUpByteCodeTargetsback to summary
public void fixUpByteCodeTargets(final ByteCode byteCode, final 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:ByteCode

a ByteCode to be fixed up

codeAttribute:CodeAttribute

a CodeAttribute used to determine how the ByteCode should be fixed up.

getback to summary
public static ByteCodeForm get(final int opcode)
getNameback to summary
public String getName()
getOpcodeback to summary
public int getOpcode()
getRewriteback to summary
public int[] getRewrite()
getRewriteCopyback to summary
public int[] getRewriteCopy()
hasMultipleByteCodesback to summary
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

boolean true if multibytecode, false otherwise

hasNoOperandback to summary
public boolean hasNoOperand()
nestedMustStartClassPoolback to summary
public boolean nestedMustStartClassPool()
operandLengthback to summary
public int operandLength()
setByteCodeOperandsback to summary
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

ByteCode to be updated (!)

operandManager:OperandManager

OperandTable from which to draw info

codeLength:int

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).

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override