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

public abstract Class VariableInstructionForm

extends ByteCodeForm
Class Inheritance
Known Direct Subclasses
org.apache.commons.compress.harmony.unpack200.bytecode.forms.WideForm, org.apache.commons.compress.harmony.unpack200.bytecode.forms.SwitchForm

This abstract class implements the common code for instructions which have variable lengths. This is currently the *switch instructions and some wide (_w) instructions.

Field Summary

Inherited from org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm:
byteCodeArraybyteCodesByNameWIDENED

Constructor Summary

AccessConstructor and Description
public
VariableInstructionForm(final int opcode, final String name)

Method Summary

Modifier and TypeMethod and Description
public void
setRewrite2Bytes(final int
value to write
operand
,
final int
position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.
absPosition
,
final int[]
array to write into
rewrite
)

This method writes operand directly into the rewrite array at index position specified.

public void
setRewrite4Bytes(final int
value to write
operand
,
final int
position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.
absPosition
,
final int[]
array to write into
rewrite
)

This method writes operand directly into the rewrite array at index position specified.

public void
setRewrite4Bytes(final int
int to set the rewrite bytes to
operand
,
final int[]
int[] bytes to rewrite
rewrite
)

Given an int operand, set the rewrite bytes for the next available operand position and the three immediately following it to a highest-byte, mid-high, mid-low, low-byte encoding of the operand.

Inherited from org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm:
calculateOperandPositionfirstOperandIndexfixUpByteCodeTargetsgetgetNamegetOpcodegetRewritegetRewriteCopyhasMultipleByteCodeshasNoOperandnestedMustStartClassPooloperandLengthsetByteCodeOperandstoString

Constructor Detail

VariableInstructionFormback to summary
public VariableInstructionForm(final int opcode, final String name)

Method Detail

setRewrite2Bytesback to summary
public void setRewrite2Bytes(final int operand, final int absPosition, final int[] rewrite)

This method writes operand directly into the rewrite array at index position specified.

Parameters
operand:int

value to write

absPosition:int

position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.

rewrite:int[]

array to write into

setRewrite4Bytesback to summary
public void setRewrite4Bytes(final int operand, final int absPosition, final int[] rewrite)

This method writes operand directly into the rewrite array at index position specified.

Parameters
operand:int

value to write

absPosition:int

position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.

rewrite:int[]

array to write into

setRewrite4Bytesback to summary
public void setRewrite4Bytes(final int operand, final int[] rewrite)

Given an int operand, set the rewrite bytes for the next available operand position and the three immediately following it to a highest-byte, mid-high, mid-low, low-byte encoding of the operand. Note that unlike the ByteCode setOperand* operations, this starts with an actual bytecode rewrite array (rather than a ByteCodeForm prototype rewrite array). Also, this method overwrites -1 values in the rewrite array - so if you start with an array that looks like: {100, -1, -1, -1, -1, 200, -1, -1, -1, -1} then calling setRewrite4Bytes(0, rewrite) the first time will convert it to: {100, 0, 0, 0, 0, 200, -1, -1, -1, -1} Calling setRewrite4Bytes(0, rewrite) a second time will convert it to: {100, 0, 0, 0, 0, 200, 0, 0, 0, 0}

Parameters
operand:int

int to set the rewrite bytes to

rewrite:int[]

int[] bytes to rewrite