FileDocCategorySizeDatePackage
Reply.javaAPI DocphoneME MR2 API (J2ME)4585Wed May 02 17:59:48 BST 2007com.sun.cldchi.tools.memoryprofiler.jdwp

Reply

public class Reply extends Packet implements VMReply
This class represents a JDWP reply packet. This class is widely used in all parts of KJDB. A typical use of tyhis class is as follows:
  • Prepare JDWP command (see jdwp.Command) for details
  • Execute the command using BackEndTest.checkReplyF() method and receive the JDWP reply packet
  • Use resetDataParser() method before starting reading packet's data
  • Read the packet's data using get ByteBuffer and Packet methods
see
jdwp.Command
see
jdwp.BackEndTest#checkReplyF(jdwp.Command)
see
jdwp.Packet
see
jdwp.Packet#resetDataParser()
see
jdwp.ByteBuffer

Fields Summary
public static final int
errOk
Error code constant that indicates that no error occured.
public static final int
errWrongPacketSize
Error code constant that indicates that the packet has wrong size.
public static final int
errNotAvailable
Error code constant that indicates that JDWP reply packet is not received as expected.
public static final int
errEvent
JDWP Event/Composite command number.
Constructors Summary
Methods Summary
static com.sun.cldchi.tools.memoryprofiler.jdwp.ReplyError(int ErrorCode)
This method prepares a JDWP reply packet with specified error code.

param
ErrorCode a error code of the JDWP reply
return
a JDWP reply with the specified error code


		Reply r = new Reply();
		r.setLength();
		r.setID(0);
		r.setFlags(flReply);
		r.setErrorCode(ErrorCode);
		return r;
    
public intgetErrorCode()
Returns value of the "error code" field of JDWP reply packet.

return
a error code of JDWP reply


                           
   	   
            int err = 0;
            try {
            	err = (int) getID(ErrorCodeOffset, 2);
            }
            catch (BoundException e) {};
            return err;
    
public booleanok()
Returns true if this packet's error code equals zero.

return
true if the JDWP reply has error code NONE and false otherwise

		return (getErrorCode() == errOk);
    
public voidsetErrorCode(long err)
Sets value of the "error code" field of JDWP reply packet.

param
err a error code of JDWP reply that should be set

   		try {
   			putID(ErrorCodeOffset, err, 2);
   		}
   		catch (BoundException e) {};
    
public java.lang.StringtoString()
Returns a string representation of the reply packet. This method is used by BackEndTest to print all the replies that were not requested by other parts of code. It's useful for localizing problems.

return
a string representation of the reply packet
see
jdwp.BackEndTest#printReplies()

        String s;
        if (getFlags() == 0)
            s = "command    ";
        else
            s = "error code ";
        return "length     " + Tools.Hex(length(), 8) + "\n" +
            "id         " + Tools.Hex(getID(), 8) + "\n" +
            "flags      " + Tools.Hex(getFlags(), 2) + "\n" +
            s + Tools.Hex(getErrorCode(), 4) + "\n" +
            super.toString(PacketHeaderSize);