當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandPacket.setNextValueAsFieldID方法代碼示例

本文整理匯總了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsFieldID方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandPacket.setNextValueAsFieldID方法的具體用法?Java CommandPacket.setNextValueAsFieldID怎麽用?Java CommandPacket.setNextValueAsFieldID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket的用法示例。


在下文中一共展示了CommandPacket.setNextValueAsFieldID方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getObjectReferenceValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns the value of one or more instance fields.
 * 
 * @param objectID
 *            The object ID
 * @param fieldIDs
 *            IDs of fields to get
 * @return An array of Value objects representing each field's value
 */
public final Value[] getObjectReferenceValues(long objectID, long[] fieldIDs) {
    int fieldsCount = fieldIDs.length;
    if (fieldsCount == 0) {
        return null;
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.GetValuesCommand);
    command.setNextValueAsReferenceTypeID(objectID);
    command.setNextValueAsInt(fieldsCount);
    for (int i = 0; i < fieldsCount; i++) {
        command.setNextValueAsFieldID(fieldIDs[i]);
    }

    ReplyPacket reply = checkReply(performCommand(command));
    reply.getNextValueAsInt(); // fields returned, is not used
    Value[] values = new Value[fieldsCount];
    for (int i = 0; i < fieldsCount; i++) {
        values[i] = reply.getNextValueAsValue();
    }

    return values;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:34,代碼來源:VmMirror.java

示例2: getReferenceTypeValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns the value of one or more static fields of the reference type
 * 
 * @param refTypeID
 *            The reference type ID.
 * @param fieldIDs
 *            IDs of fields to get
 * @return An array of Value objects representing each field's value
 */
public final Value[] getReferenceTypeValues(long refTypeID, long[] fieldIDs) {
    int fieldsCount = fieldIDs.length;
    if (fieldsCount == 0) {
        return null;
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
    command.setNextValueAsReferenceTypeID(refTypeID);
    command.setNextValueAsInt(fieldsCount);
    for (int i = 0; i < fieldsCount; i++) {
        command.setNextValueAsFieldID(fieldIDs[i]);
    }

    ReplyPacket reply = checkReply(performCommand(command));
    reply.getNextValueAsInt(); // fields returned, is not used
    Value[] values = new Value[fieldsCount];
    for (int i = 0; i < fieldsCount; i++) {
        values[i] = reply.getNextValueAsValue();
    }

    return values;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:34,代碼來源:VmMirror.java

示例3: setInstanceFieldsValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Sets the value of one or more instance fields
 * 
 * @param objectID
 *            The object ID.
 * @param fieldIDs
 *            An array of fields IDs
 * @param values
 *            An array of Value objects representing each value to set
 */
public final void setInstanceFieldsValues(long objectID, long[] fieldIDs,
        Value[] values) {
    if (fieldIDs.length != values.length) {
        throw new TestErrorException(
                "Number of fields doesn't correspond to number of their values");
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
    command.setNextValueAsObjectID(objectID);
    command.setNextValueAsInt(fieldIDs.length);
    for (int i = 0; i < fieldIDs.length; i++) {
        command.setNextValueAsFieldID(fieldIDs[i]);
        command.setNextValueAsUntaggedValue(values[i]);
    }

    checkReply(performCommand(command));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:30,代碼來源:VmMirror.java

示例4: setStaticFieldsValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Sets the value of one or more static fields
 * 
 * @param classID
 *            The class type ID.
 * @param fieldIDs
 *            An array of fields IDs
 * @param values
 *            An array of Value objects representing each value to set
 */
public final void setStaticFieldsValues(long classID, long[] fieldIDs,
        Value[] values) {
    if (fieldIDs.length != values.length) {
        throw new TestErrorException(
                "Number of fields doesn't correspond to number of their values");
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.ClassTypeCommandSet.CommandSetID,
            JDWPCommands.ClassTypeCommandSet.SetValuesCommand);
    command.setNextValueAsClassID(classID);
    command.setNextValueAsInt(fieldIDs.length);
    for (int i = 0; i < fieldIDs.length; i++) {
        command.setNextValueAsFieldID(fieldIDs[i]);
        command.setNextValueAsUntaggedValue(values[i]);
    }

    checkReply(performCommand(command));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:30,代碼來源:VmMirror.java

示例5: checkArrayValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
private void checkArrayValues(ArrayRegion valuesRegion, long classID,
                              long fieldID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
    packet.setNextValueAsReferenceTypeID(classID);
    packet.setNextValueAsInt(1);
    packet.setNextValueAsFieldID(fieldID);

    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ReferenceType::GetValues command");

    assertEquals("GetValuesCommand returned invalid number of values,", 1, reply.getNextValueAsInt());
    Value value = reply.getNextValueAsValue();
    //System.err.println("value="+value);
    long arrayID = value.getLongValue();
    int length = valuesRegion.getLength();

    checkArrayRegion(valuesRegion, arrayID, 0, length);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:21,代碼來源:SetValuesTest.java

示例6: setStaticIntField

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Helper for setting static int field in class with new value.
 * 
 * @param classSignature -
 *            String defining signature of class
 * @param fieldName -
 *            String defining field name in specified class
 * @param newValue -
 *            int value to set for specified field
 * @return true, if setting is successfully, or false otherwise
 */
protected boolean setStaticIntField(String classSignature,
        String fieldName, int newValue) {

    long classID = debuggeeWrapper.vmMirror.getClassID(classSignature);
    if (classID == -1) {
        logWriter
                .println("## setStaticIntField(): Can NOT get classID for class signature = '"
                        + classSignature + "'");
        return false;
    }

    long fieldID = debuggeeWrapper.vmMirror.getFieldID(classID, fieldName);
    if (fieldID == -1) {
        logWriter
                .println("## setStaticIntField(): Can NOT get fieldID for field = '"
                        + fieldName + "'");
        return false;
    }

    CommandPacket packet = new CommandPacket(
            JDWPCommands.ClassTypeCommandSet.CommandSetID,
            JDWPCommands.ClassTypeCommandSet.SetValuesCommand);
    packet.setNextValueAsReferenceTypeID(classID);
    packet.setNextValueAsInt(1);
    packet.setNextValueAsFieldID(fieldID);
    packet.setNextValueAsInt(newValue);

    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    int errorCode = reply.getErrorCode();
    if (errorCode != JDWPConstants.Error.NONE) {
        logWriter
                .println("## setStaticIntField(): Can NOT set value for field = '"
                        + fieldName
                        + "' in class = '"
                        + classSignature
                        + "'; ClassType.SetValues command reurns error = "
                        + errorCode);
        return false;
    }
    return true;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:53,代碼來源:JDWPTestCase.java

示例7: checkArrayValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
private void checkArrayValues(long classID, long fieldID, int error, int length,
        int checksNumber, byte expectedArrayTag, byte expectedElementTag, boolean checkValues)
throws UnsupportedEncodingException {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
    // set referenceTypeID
    packet.setNextValueAsReferenceTypeID(classID);
    // repeat 1 time
    packet.setNextValueAsInt(1);
    // set fieldID
    packet.setNextValueAsFieldID(fieldID);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ReferenceType::GetValues command");

    assertEquals("ReferenceType::GetValues command returned invalid int value,", reply.getNextValueAsInt(), 1);
    Value value = reply.getNextValueAsValue();
    long arrayID = value.getLongValue(); 
    logWriter.println("==> testGetValues001: checked arrayID = " + arrayID);
    
    logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
            + "; Expected error = " + error + "(" + JDWPConstants.Error.getName(error) + ")"
            + "; firstIndex = 0; length = " + length);
    checkArrayRegion
    (arrayID, error, 0, length, expectedArrayTag, expectedElementTag, checkValues);
    logWriter.println("==> PASSED!");
    
    if ( checksNumber > 1 ) {
        logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
            + "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
            + "; firstIndex = 1; length = " + (length-1));
        checkArrayRegion
        (arrayID, error, 1, length-1, expectedArrayTag, expectedElementTag, checkValues);
        logWriter.println("==> PASSED!");
    
        logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
            + "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
            + "; firstIndex = 0; length = " + (length-1));
        checkArrayRegion
        (arrayID, error, 0, length-1, expectedArrayTag, expectedElementTag, checkValues);
        logWriter.println("==> PASSED!");
    
        logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
            + "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
            + "; firstIndex = " + (length-1) + " length = 1");
        checkArrayRegion
        (arrayID, error, length-1, 1, expectedArrayTag, expectedElementTag, checkValues);
        logWriter.println("==> PASSED!");
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:51,代碼來源:GetValuesTest.java


注:本文中的org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsFieldID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。