Exemplo n.º 1
0
 public void writeNullLocation(String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[location]  " + s + "=null");
   dos.writeByte(JDWP.TypeTag_CLASS);
   writeReferenceTypeID(ReferenceTypeID.NULL, null);
   dos.writeInt(0);
   dos.writeLong(0);
 }
Exemplo n.º 2
0
 /**
  * Writes a primitive value to this stream preceeded by a tag describing the type and data size
  * (in bytes) of the value.
  *
  * @param tag a <code>JDWP.Tag_...</code> value
  * @param value the value to write
  * @throws IOException if there was an IO error while writing
  */
 public void writePrimitive(byte tag, long value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[t-prim]:  " + s + "=" + value);
   dos.writeByte(tag);
   switch (tag) {
     case JDWP.Tag_VOID:
       break;
     case JDWP.Tag_BYTE:
     case JDWP.Tag_BOOLEAN:
       dos.writeByte((byte) value);
       break;
     case JDWP.Tag_CHAR:
     case JDWP.Tag_SHORT:
       dos.writeShort((short) value);
       break;
     case JDWP.Tag_INT:
     case JDWP.Tag_FLOAT:
       dos.writeInt((int) value);
       break;
     case JDWP.Tag_LONG:
     case JDWP.Tag_DOUBLE:
       dos.writeLong(value);
       break;
     default:
       Assert.shouldNotReachHere();
   }
 }
Exemplo n.º 3
0
  /**
   * Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent
   * manner.
   *
   * <p>First, four bytes are written to the output stream as if by the <code>writeInt</code> method
   * giving the number of bytes to follow. This value is the number of bytes actually written out,
   * not the length of the string. Following the length, each character of the string is output, in
   * sequence, using the UTF-8 encoding for the character.
   *
   * @param value a string to be written.
   * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
   * @throws IOException if there was an IO error while writing
   */
  public void writeString(String value, String s) throws IOException {
    if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[string]   " + s + "=" + value);

    // A String is encoded in a JDWP packet as a UTF-8 encoded array, not zero
    // terminated, preceded by a *four-byte* integer length.
    com.sun.squawk.util.DataOutputUTF8Encoder.writeUTF(value, dos, false);
  }
Exemplo n.º 4
0
 public void writeLocation(Location value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[location] " + s + "=" + value);
   dos.writeByte(value.tag);
   writeReferenceTypeID(value.definingClass, null);
   writeMethodID(value.method, null);
   dos.writeLong(value.offset);
 }
Exemplo n.º 5
0
 /**
  * Writes an int value to this stream.
  *
  * @param value an <code>int</code> value to be written.
  * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
  * @throws IOException if there was an IO error while writing
  */
 public void writeInt(int value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[int]      " + s + "=" + value);
   dos.writeInt(value);
 }
Exemplo n.º 6
0
 /**
  * Writes a char value to this stream.
  *
  * @param value a <code>char</code> value to be written.
  * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
  * @throws IOException if there was an IO error while writing
  */
 public void writeChar(char value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[string]   " + s + "=" + value);
   dos.writeChar(value);
 }
Exemplo n.º 7
0
 /**
  * Writes a boolean value to this stream.
  *
  * @param value a <code>boolean</code> value to be written.
  * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
  * @throws IOException if there was an IO error while writing
  */
 public void writeBoolean(boolean value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[boolean]  " + s + "=" + value);
   dos.writeBoolean(value);
 }
Exemplo n.º 8
0
 public void writeFrameID(FrameID value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[frame]    " + s + "=" + value);
   writeObjectID(value.threadID, null);
   dos.writeInt(value.frame);
 }
Exemplo n.º 9
0
 public void writeFieldID(FieldID value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[field]    " + s + "=" + value);
   writeReferenceTypeID(value.definingClass, "defining class");
   dos.writeInt(value.encoding);
 }
Exemplo n.º 10
0
 public void writeMethodID(MethodID value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[method]   " + s + "=" + value);
   dos.writeInt(value.id);
 }
Exemplo n.º 11
0
 public void writeTaggedObjectID(TaggedObjectID value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[t-object] " + s + "=" + value);
   dos.writeByte(value.tag);
   dos.writeInt(value.id);
 }
Exemplo n.º 12
0
 public void writeReferenceTypeID(ReferenceTypeID value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose()) Log.log("out[type]     " + s + "=" + value);
   dos.writeInt(value.id);
 }
Exemplo n.º 13
0
 /**
  * Writes a double value to this stream.
  *
  * @param value a <code>double</code> value to be written.
  * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
  * @throws IOException if there was an IO error while writing
  */
 public void writeDouble(double value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose())
     Log.log("out[double]   " + s + "=" + (long) value);
   dos.writeLong(Double.doubleToLongBits(value));
 }
Exemplo n.º 14
0
 /**
  * Writes a float value to this stream.
  *
  * @param value a <code>float</code> value to be written.
  * @param s prefix to use if this write is logged. A value of null prevents logging altogether.
  * @throws IOException if there was an IO error while writing
  */
 public void writeFloat(float value, String s) throws IOException {
   if (ENABLE_VERBOSE && s != null && Log.verbose())
     Log.log("out[float]    " + s + "=" + (int) value);
   dos.writeInt(Float.floatToIntBits(value));
 }