org.ow2.asmdex.instruction
Class InstructionFormat31C

java.lang.Object
  extended by org.ow2.asmdex.instruction.Instruction
      extended by org.ow2.asmdex.instruction.InstructionFormat31C
All Implemented Interfaces:
IIndexInstruction, IOneRegisterInstruction

public class InstructionFormat31C
extends Instruction
implements IOneRegisterInstruction, IIndexInstruction

Encodes and decodes an instruction built with the Dalvik format 31C.

Author:
Julien Névo

Field Summary
 
Fields inherited from class org.ow2.asmdex.instruction.Instruction
lineNumber, opcodeByte, opcodeHighOrderByte
 
Constructor Summary
InstructionFormat31C(int opcode, java.lang.String string, int registerA)
          Constructor of the Instruction.
 
Method Summary
 int getIndex()
          Returns the Index stored in this Instruction.
static int getIndexB(IDalvikValueReader reader)
          Returns the IndexB encoded where the Reader points.
 int getRegisterA()
          The index of the register (called A value in Dalvik documentation)
static int getRegisterA(int opcode)
          Returns the RegisterA encoded in the given 16-bit opcode.
 int getSize()
          Returns the size of the instruction in bytes.
static void skip(IDalvikValueReader reader)
          Skips the data of this Instruction.
 void write(ByteVector out, ConstantPool constantPool)
          Encodes the instruction, in the Dalvik format, to an output buffer.
 
Methods inherited from class org.ow2.asmdex.instruction.Instruction
getInstructionSizeInByte, getLineNumber, getOpcodeByte, getOpcodeHighOrderByte, setLineNumber, test4BitsLimit, test4BitsLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstructionFormat31C

public InstructionFormat31C(int opcode,
                            java.lang.String string,
                            int registerA)
Constructor of the Instruction.

Parameters:
opcode - 8 or 16 bits opcode.
string - string related the index this Instruction is holding.
registerA - the register this Instruction holds.
Method Detail

getRegisterA

public int getRegisterA()
Description copied from interface: IOneRegisterInstruction
The index of the register (called A value in Dalvik documentation)

Specified by:
getRegisterA in interface IOneRegisterInstruction
Returns:
regoster A index

getIndex

public int getIndex()
Description copied from interface: IIndexInstruction
Returns the Index stored in this Instruction.

Specified by:
getIndex in interface IIndexInstruction
Returns:
the Index stored in this Instruction.

getRegisterA

public static int getRegisterA(int opcode)
Returns the RegisterA encoded in the given 16-bit opcode.

Returns:
the RegisterA .

getIndexB

public static int getIndexB(IDalvikValueReader reader)
Returns the IndexB encoded where the Reader points. It must be performed only once after having read the opcode.

Parameters:
reader - reader pointing after the 16-bit opcode.
Returns:
the IndexB.

skip

public static void skip(IDalvikValueReader reader)
Skips the data of this Instruction.

Parameters:
reader - reader on the Instruction to parse, pointing after the 16-bit opcode.

getSize

public int getSize()
Description copied from class: Instruction
Returns the size of the instruction in bytes.

Specified by:
getSize in class Instruction
Returns:
the size of the instruction in bytes.

write

public void write(ByteVector out,
                  ConstantPool constantPool)
Description copied from class: Instruction
Encodes the instruction, in the Dalvik format, to an output buffer.

Specified by:
write in class Instruction
Parameters:
out - output buffer.
constantPool - the constantPool.