/// <summary> /// Gets a byte from the current offset relative to the start of the data part. /// </summary> public byte GetByte() { var x = Offset; Offset += 1; return(packet.GetByte(x)); }
/// <summary> /// Read an untagged value. /// </summary> private static object ReadUntaggedValue(JdwpPacket.DataReaderWriter readerWriter, Jdwp.Tag tag) { switch (tag) { case Jdwp.Tag.Array: case Jdwp.Tag.Object: case Jdwp.Tag.String: case Jdwp.Tag.Thread: case Jdwp.Tag.ThreadGroup: case Jdwp.Tag.ClassLoader: case Jdwp.Tag.ClassObject: return new ObjectId(readerWriter); case Jdwp.Tag.Byte: return readerWriter.GetByte(); case Jdwp.Tag.Char: return (char)readerWriter.GetInt16(); case Jdwp.Tag.Float: return readerWriter.GetFloat(); case Jdwp.Tag.Double: return readerWriter.GetDouble(); case Jdwp.Tag.Int: return readerWriter.GetInt(); case Jdwp.Tag.Long: return readerWriter.GetLong(); case Jdwp.Tag.Short: return readerWriter.GetInt16(); case Jdwp.Tag.Void: return null; case Jdwp.Tag.Boolean: return readerWriter.GetBoolean(); default: throw new ArgumentException("Unknown tag " + (int)tag); } }
/// <summary> /// Read a tagged value. /// </summary> public Value(JdwpPacket.DataReaderWriter readerWriter) { Tag = (Jdwp.Tag) readerWriter.GetByte(); ValueObject = ReadUntaggedValue(readerWriter, Tag); }