53 data.put((byte) cmdSet);
54 data.put((byte) cmd);
55 if (replyClz != null) {
56 try {
57 reply = replyClz.newInstance();
58 } catch (Exception ex) {
59 ex.printStackTrace();
60 }
61 }
62 }
63
64 JdwpCmd(int cmd, int cmdSet, Class<T> replyClz) {
65 this(cmd, cmdSet, replyClz, 0);
66 }
67
68 int getDataLength() {
69 return dataLen;
70 }
71
72 public final T send(JdwpChannel channel) throws IOException {
73 channel.write(data.array(), HEADER_LEN + getDataLength());
74 if (reply != null) {
75 reply.initFromStream(channel.getInputStream());
76 }
77 return (T) reply;
78 }
79
80 protected void putRefId(long refId) {
81 data.putLong(refId);
82 }
83
84 protected void putInt(int val) {
85 data.putInt(val);
86 }
87
88 protected static int refLen() {
89 return 8;
90 }
91
92 }
|
53 data.put((byte) cmdSet);
54 data.put((byte) cmd);
55 if (replyClz != null) {
56 try {
57 reply = replyClz.newInstance();
58 } catch (Exception ex) {
59 ex.printStackTrace();
60 }
61 }
62 }
63
64 JdwpCmd(int cmd, int cmdSet, Class<T> replyClz) {
65 this(cmd, cmdSet, replyClz, 0);
66 }
67
68 int getDataLength() {
69 return dataLen;
70 }
71
72 public final T send(JdwpChannel channel) throws IOException {
73 System.err.println("Sending command: " + this);
74 channel.write(data.array(), HEADER_LEN + getDataLength());
75 if (reply != null) {
76 reply.initFromStream(channel.getInputStream());
77 }
78 return (T) reply;
79 }
80
81 protected void putRefId(long refId) {
82 data.putLong(refId);
83 }
84
85 protected void putInt(int val) {
86 data.putInt(val);
87 }
88
89 protected static int refLen() {
90 return 8;
91 }
92
93 }
|