/** * 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(); } }
/** * Copy a tagged value (primitive or object) from the input stream to the output stream. including * a tag. * * @param in a PacketInputStream containing a tag and a value to copy. * @throws IOException if there was an IO error while writing */ public void copyTaggedValue(PacketInputStream in) throws IOException { int tag = in.readByte("tag"); writeByte(tag, "tag"); copyValue(tag, in); }