本文整理匯總了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsArrayID方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandPacket.setNextValueAsArrayID方法的具體用法?Java CommandPacket.setNextValueAsArrayID怎麽用?Java CommandPacket.setNextValueAsArrayID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket
的用法示例。
在下文中一共展示了CommandPacket.setNextValueAsArrayID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setArrayValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
* Sets a range of array components. The specified range must be within the
* bounds of the array.
*
* @param arrayID
* The array object ID.
* @param firstIndex
* The first index to set.
* @param values
* An array of Value objects representing each value to set.
*/
public final void setArrayValues(long arrayID, int firstIndex,
Value[] values) {
CommandPacket command = new CommandPacket(
JDWPCommands.ArrayReferenceCommandSet.CommandSetID,
JDWPCommands.ArrayReferenceCommandSet.SetValuesCommand);
command.setNextValueAsArrayID(arrayID);
command.setNextValueAsInt(firstIndex);
command.setNextValueAsInt(values.length);
for (int i = 0; i < values.length; i++) {
command.setNextValueAsUntaggedValue(values[i]);
}
checkReply(performCommand(command));
}
示例2: checkArrayRegion
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
private void checkArrayRegion(long arrayID, int error, int firstIndex, int length,
byte expectedArrayTag, byte expectedElementTag, boolean checkValues)
throws UnsupportedEncodingException {
CommandPacket packet = new CommandPacket(
JDWPCommands.ArrayReferenceCommandSet.CommandSetID,
JDWPCommands.ArrayReferenceCommandSet.GetValuesCommand);
packet.setNextValueAsArrayID(arrayID);
packet.setNextValueAsInt(firstIndex);
packet.setNextValueAsInt(length);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ArrayReference::GetValues command", error);
if (reply.getErrorCode() == JDWPConstants.Error.NONE) {
// do not check values for non-array fields
ArrayRegion region = reply.getNextValueAsArrayRegion();
//System.err.println("length="+region.length);
byte arrayTag = region.getTag();
logWriter.println("==> arrayTag = " + arrayTag
+ "(" + JDWPConstants.Tag.getName(arrayTag) + ")");
logWriter.println("==> arrayLength = "+region.getLength());
Value value_0 = region.getValue(0);
byte elementTag = value_0.getTag();
logWriter.println("==> elementTag = " + elementTag
+ "(" + JDWPConstants.Tag.getName(elementTag) + ")");
assertEquals("ArrayReference::GetValues returned invalid array tag,",
expectedArrayTag, arrayTag,
JDWPConstants.Tag.getName(expectedArrayTag),
JDWPConstants.Tag.getName(arrayTag));
assertEquals("ArrayReference::GetValues returned invalid array length,",
length, region.getLength());
assertEquals("ArrayReference::GetValues returned invalid element tag",
expectedElementTag, elementTag,
JDWPConstants.Tag.getName(expectedElementTag),
JDWPConstants.Tag.getName(elementTag));
if (checkValues) {
for (int i = 0; i < region.getLength(); i++) {
Value value = region.getValue(i);
if (value.getTag() == JDWPConstants.Tag.INT_TAG) {
assertEquals("ArrayReference::GetValues returned invalid value on index:<" + i + ">,",
value.getIntValue(), i + firstIndex);
}
else if (value.getTag() == JDWPConstants.Tag.STRING_TAG) {
long stringID = value.getLongValue();
String s = getStringValue(stringID);
assertEquals("ArrayReference::GetValues returned invalid value on index:<" + i + ">,",
Integer.parseInt(s), i + firstIndex);
}
}
}
}
}