本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsString方法的典型用法代码示例。如果您正苦于以下问题:Java ReplyPacket.getNextValueAsString方法的具体用法?Java ReplyPacket.getNextValueAsString怎么用?Java ReplyPacket.getNextValueAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket
的用法示例。
在下文中一共展示了ReplyPacket.getNextValueAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSyntheticMethod
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
private static boolean isSyntheticMethod(VmMirror mirror, Location location) {
// We must gather the modifiers of the method. This is only possible using
// ReferenceType.Methods command which gather information about all methods in a class.
ReplyPacket reply = mirror.getMethods(location.classID);
int methodsCount = reply.getNextValueAsInt();
for (int i = 0; i < methodsCount; ++i) {
long methodId = reply.getNextValueAsMethodID();
reply.getNextValueAsString(); // skip method name
reply.getNextValueAsString(); // skip method signature
int modifiers = reply.getNextValueAsInt();
if (methodId == location.methodID &&
((modifiers & SYNTHETIC_FLAG) != 0)) {
return true;
}
}
return false;
}
示例2: getFieldID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Gets FieldID from ReplyPacket.
*
* @param request
* ReplyPacket for request
* @param field
* field name to get ID for
* @return received FieldID
*/
public long getFieldID(ReplyPacket request, String field) {
long fieldID = -1;
String fieldName;
// Get fieldID from received packet
int count = request.getNextValueAsInt();
for (int i = 0; i < count; i++) {
fieldID = request.getNextValueAsFieldID();
fieldName = request.getNextValueAsString();
if (field.equals(fieldName)) {
request.getNextValueAsString();
request.getNextValueAsInt();
break;
} else {
request.getNextValueAsString();
request.getNextValueAsInt();
fieldID = 0;
fieldName = null;
}
}
return fieldID;
}
示例3: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns method name for specified pair of classID and methodID.
*
* @param classID
* @param methodID
* @return method name
*/
public String getMethodName(long classID, long methodID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
packet.setNextValueAsReferenceTypeID(classID);
ReplyPacket reply = performCommand(packet);
int declared = reply.getNextValueAsInt();
long mID;
String value = null;
String methodName = "";
for (int i = 0; i < declared; i++) {
mID = reply.getNextValueAsMethodID();
methodName = reply.getNextValueAsString();
reply.getNextValueAsString();
reply.getNextValueAsInt();
if (mID == methodID) {
value = methodName;
break;
}
}
return value;
}
示例4: getAllFields
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns information for each field in a reference type including
* inherited fields
*
* @param classID
* The reference type ID
* @return A list of Field objects representing each field of the class
*/
public final List getAllFields(long classID) {
ArrayList<Field> fields = new ArrayList<Field>(0);
long superID = getSuperclassId(classID);
if (superID != 0) {
List superClassFields = getAllFields(superID);
for (int i = 0; i < superClassFields.size(); i++) {
fields.add((Field) superClassFields.toArray()[i]);
}
}
ReplyPacket reply = getFieldsInClass(classID);
int fieldsCount = reply.getNextValueAsInt();
for (int i = 0; i < fieldsCount; i++) {
Field field = new Field(reply.getNextValueAsFieldID(), classID,
reply.getNextValueAsString(), reply.getNextValueAsString(),
reply.getNextValueAsInt());
fields.add(field);
}
return fields;
}
示例5: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
protected String getMethodName(long classID, long methodID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
packet.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
if (!checkReplyPacketWithoutFail(reply, "ReferenceType::Methods command")) {
throw new TestErrorException("Error during performing ReferenceType::Method command");
}
int methods = reply.getNextValueAsInt();
for (int i = 0; i < methods; i++) {
long mid = reply.getNextValueAsMethodID();
String name = reply.getNextValueAsString();
reply.getNextValueAsString();
reply.getNextValueAsInt();
if (mid == methodID) {
return name;
}
}
return "unknown";
}
示例6: jdwpGetVariableTable
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
protected VarInfo[] jdwpGetVariableTable(long classID, long methodID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.MethodCommandSet.CommandSetID,
JDWPCommands.MethodCommandSet.VariableTableCommand);
packet.setNextValueAsClassID(classID);
packet.setNextValueAsMethodID(methodID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "Method::VariableTable command");
reply.getNextValueAsInt();
int varNumber = reply.getNextValueAsInt();
VarInfo[] varInfos = new VarInfo[varNumber];
for (int i = 0; i < varNumber; i++) {
reply.getNextValueAsLong();
String name = reply.getNextValueAsString();
String sign = reply.getNextValueAsString();
reply.getNextValueAsInt();
int slot = reply.getNextValueAsInt();
varInfos[i] = new VarInfo(name, slot, sign);
}
return varInfos;
}
示例7: jdwpGetFields
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns for specified class array with information about fields of this class.
* <BR>Each element of array contains:
* <BR>Field ID, Field name, Field signature, Field modifier bit flags;
* @param refType - ReferenceTypeID, defining class.
* @return array with information about fields.
*/
protected FieldInfo[] jdwpGetFields(long refType) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
packet.setNextValueAsReferenceTypeID(refType);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
int declared = reply.getNextValueAsInt();
FieldInfo[] fields = new FieldInfo[declared];
for (int i = 0; i < declared; i++) {
fields[i] =
new FieldInfo(reply.getNextValueAsFieldID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt());
}
return fields;
}
示例8: jdwpGetFieldIDs
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
private FieldInfo[] jdwpGetFieldIDs(long classID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
packet.setNextValueAsReferenceTypeID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ReferenceType::Fields command");
int declared = reply.getNextValueAsInt();
FieldInfo[] fields = new FieldInfo[declared];
for (int i = 0; i < declared; i++) {
fields[i] = new FieldInfo(
reply.getNextValueAsFieldID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt()
);
}
return fields;
}
示例9: jdwpGetMethodsInfo
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
protected MethodInfo[] jdwpGetMethodsInfo(long classID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
packet.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
int declared = reply.getNextValueAsInt();
MethodInfo[] methodsInfo = new MethodInfo[declared];
for (int i = 0; i < declared; i++) {
methodsInfo[i] = new MethodInfo(
reply.getNextValueAsMethodID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt()
);
}
return methodsInfo;
}
示例10: getMethodID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Helper for getting method ID of corresponding class and method name.
*
* @param classID -
* class ID
* @param methodName -
* method name
* @return method ID
*/
protected long getMethodID(long classID, String methodName) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
command.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(command);
checkReplyPacket(reply, "ReferenceType::Methods command");
int methods = reply.getNextValueAsInt();
for (int i = 0; i < methods; i++) {
long methodID = reply.getNextValueAsMethodID();
String name = reply.getNextValueAsString(); // method name
reply.getNextValueAsString(); // method signature
reply.getNextValueAsInt(); // method modifiers
if (name.equals(methodName)) {
return methodID;
}
}
return -1;
}
示例11: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Helper for getting method name of corresponding class and method ID.
*
* @param classID class id
* @param methodID method id
* @return String
*/
protected String getMethodName(long classID, long methodID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
packet.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ReferenceType::Methods command");
int methods = reply.getNextValueAsInt();
for (int i = 0; i < methods; i++) {
long mid = reply.getNextValueAsMethodID();
String name = reply.getNextValueAsString();
reply.getNextValueAsString();
reply.getNextValueAsInt();
if (mid == methodID) {
return name;
}
}
return "unknown";
}
示例12: getSourceFile
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
public String getSourceFile() {
// TODO(shertz) support JSR-45
Location location = getLocation();
CommandPacket sourceFileCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SourceFileCommand);
sourceFileCommand.setNextValueAsReferenceTypeID(location.classID);
ReplyPacket replyPacket = getMirror().performCommand(sourceFileCommand);
if (replyPacket.getErrorCode() != 0) {
return null;
} else {
return replyPacket.getNextValueAsString();
}
}
示例13: getClassSignature
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Gets class signature for specified class ID.
*
* @param classID
* class ID
* @return received class signature
*/
public String getClassSignature(long classID) {
// Create new command packet
CommandPacket commandPacket = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
commandPacket.setNextValueAsReferenceTypeID(classID);
ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
return replyPacket.getNextValueAsString();
}
示例14: testSourceFile001
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ReferenceType.SourceFile command.
* >BR>The test starts SourceFileDebuggee class, requests referenceTypeId
* for this class by VirtualMachine.ClassesBySignature command, then
* performs ReferenceType.SourceFile command and checks that returned
* source file name is equal to expected name.
*/
public void testSourceFile001() {
String thisTestName = "testSourceFile001";
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
finalSyncMessage = JPDADebuggeeSynchronizer.SGNL_CONTINUE;
long refTypeID = getClassIDBySignature(debuggeeSignature);
logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
CommandPacket sourceFileCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SourceFileCommand);
sourceFileCommand.setNextValueAsReferenceTypeID(refTypeID);
ReplyPacket sourceFileReply = debuggeeWrapper.vmMirror.performCommand(sourceFileCommand);
sourceFileCommand = null;
checkReplyPacket(sourceFileReply, thisCommandName);
String returnedSourceFile = sourceFileReply.getNextValueAsString();
String expectedSourceFile = "SourceFileDebuggee.java";
assertString(thisCommandName + " returned invalid source file,",
expectedSourceFile, returnedSourceFile);
logWriter.println("=> CHECK: PASSED: expected source file is returned = " +
returnedSourceFile);
finalSyncMessage = null;
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
assertAllDataRead(sourceFileReply);
}
示例15: getMethodID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Gets Method ID for specified class and method name.
*
* @param classID
* class to find method
* @param methodName
* method name
* @return received MethodID
*/
public long getMethodID(long classID, String methodName) {
ReplyPacket reply;
int declared = 0;
String method = null;
long methodID = -1;
// Get Method reference ID
reply = getMethods(classID);
// Get methodID from received packet
declared = reply.getNextValueAsInt();
for (int i = 0; i < declared; i++) {
methodID = reply.getNextValueAsMethodID();
method = reply.getNextValueAsString();
if (methodName.equals(method)) {
// If this method name is the same as requested
reply.getNextValueAsString();
reply.getNextValueAsInt();
break;
} else {
// If this method name is not the requested one
reply.getNextValueAsString();
reply.getNextValueAsInt();
methodID = -1;
method = null;
}
}
return methodID;
}