Commandpublic class Command extends Packet This class encapsulates JDWP command. Its superclass
is Packet so it's based on ByteBuffer .
The class allows to set and get JDWP command number and automatically
assign command ID. The typical use of Command class is
as follows:
- Create a new command object with specified command number
- Fill command's data using standard
ByteBuffer
and Packet methods (for example, addInt() or
addReferenceTypeID() )
- Execute command using
BackEndTest.checkReplyF() ,
BackEndTest.sendCommand() or
BackEndTest.checkReply()
- Work with received
Reply object if needed
|
Fields Summary |
---|
private static int | nextIDID of next command. Each JDWP command must have
unique ID. The simplest way (that is used here) for generating
these IDs is a incremental counter. So this variable is incremented
after creating of each command and contains ID of next command. |
Constructors Summary |
---|
public Command(int command)Creates a new Command object, assign an unique ID,
the specified command number and sets flags to flNoFlags .
Command number is two-byte integer where hi-order byte specifies the
JDWP command set and low-order byte specifies the command number in the
command set. For example, ArrayReference/GetValues JDWP command has a
number 0x0D02 where 0x0D = 14 is a number
of ArrayReference command set and 0x02 is a number of
GetValues command in this command set. For information about numbers
of specific commands and command sets see JDWP specification.
super();
setID(nextID++);
setFlags(flNoFlags);
setCommand(command);
|
Methods Summary |
---|
public int | getCommand()Gets number of the command assigned for this object. For information
about command numbers see description of the constructor.
I suspect this method is not used currently by KJDB
int id = 0;
try {
id = (int) getID(CommandOffset, 2);
}
catch (BoundException e) {};
return id;
| public static int | getLastID()Returns the ID of the command last created. I think that
this method is not used currently by KJDB.
return (nextID - 1);
| public void | setCommand(int command)Assign a command number to the object. For information
about command numbers see description of the constructor.
This method is used internally by constructor.
try {
putID(CommandOffset, command, 2);
}
catch (BoundException e) {};
| public java.lang.String | toString()Returns string representation of the object. This method is invoked
when reply packet of the command is not received (usually it's a
fatal error). It's useful for locating the problem.
int l = 0;
try {
l = getInt(LengthOffset);
}
catch (BoundException e) {};
return "length " + Tools.Hex(l, 8) + "\n" +
"id " + Tools.Hex(getID(), 8) + "\n" +
"flags " + Tools.Hex(getFlags(), 2) + "\n" +
"command " + Tools.Hex(getCommand(), 4) + "\n" +
super.toString(PacketHeaderSize);
|
|