/** * Copy a value (primitive or object) from the input stream to the output stream. using the * specified tag. * * @param tag a <code>JDWP.Tag_...</code> value * @param in a PacketInputStream containing a value to copy. * @throws IOException if there was an IO error while writing */ public void copyValue(int tag, PacketInputStream in) throws IOException { switch (tag) { case JDWP.Tag_BYTE: case JDWP.Tag_BOOLEAN: writeByte(in.readByte("value"), "value"); break; case JDWP.Tag_CHAR: case JDWP.Tag_SHORT: writeShort(in.readShort("value"), "value"); break; case JDWP.Tag_INT: case JDWP.Tag_FLOAT: writeInt(in.readInt("value"), "value"); break; case JDWP.Tag_LONG: case JDWP.Tag_DOUBLE: writeLong(in.readLong("value"), "value"); break; case JDWP.Tag_OBJECT: case JDWP.Tag_STRING: case JDWP.Tag_THREAD: case JDWP.Tag_CLASS_OBJECT: case JDWP.Tag_ARRAY: { writeObjectID(in.readObjectID("value"), "value"); break; } default: Assert.shouldNotReachHere(); } }
/** * 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(); } }
/** * Creates a ProxyType for a class. * * @param klass the class * @param id the JDWP identifier for the class * @param ptm the object that created this proxy type and is used to lookup other proxy types */ ProxyType(Klass klass, ReferenceTypeID id, ProxyTypeManager ptm) { this.ptm = ptm; this.id = id; Assert.that(klass != null); this.klass = klass; }