diff options
author | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-30 18:00:25 +0000 |
---|---|---|
committer | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-30 18:00:25 +0000 |
commit | 24774b321dc5a19bd761d5cda67f3b2e91b67905 (patch) | |
tree | eea43e71eefaa41c70dbdc2557e895d0a31b2f2d /libjava | |
parent | 96ecec54419a247d7111ac8927bf0921416f4a65 (diff) | |
download | gcc-24774b321dc5a19bd761d5cda67f3b2e91b67905.tar.gz |
* gnu/classpath/jdwp/transport/JdwpConnection.java (sendEvent): New
method.
(_bytes): New member.
(_doStream): New member.
(JdwpConnection): Initialize new members.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101471 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/transport/JdwpConnection.java | 38 |
2 files changed, 44 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4a3f7468c03..29dcb15654d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2005-06-30 Keith Seitz <keiths@redhat.com> + + * gnu/classpath/jdwp/transport/JdwpConnection.java (sendEvent): New + method. + (_bytes): New member. + (_doStream): New member. + (JdwpConnection): Initialize new members. + 2005-06-29 Kelley Cook <kcook@gcc.gnu.org> * all files: Update for new FSF address. diff --git a/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java b/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java index 5ddf86c863a..ffc8a176738 100644 --- a/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java +++ b/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java @@ -40,7 +40,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.transport; import gnu.classpath.jdwp.Jdwp; +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.event.EventRequest; +import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -64,7 +67,8 @@ public class JdwpConnection extends Thread { // The JDWP handshake - private static final byte[] _HANDSHAKE = {'J', 'D', 'W', 'P', '-', 'H', 'a', 'n', 'd', 's', 'h', 'a', 'k', 'e'}; + private static final byte[] _HANDSHAKE = {'J', 'D', 'W', 'P', '-', 'H', 'a', + 'n', 'd', 's', 'h', 'a', 'k', 'e'}; // Transport method private ITransport _transport; @@ -81,6 +85,12 @@ public class JdwpConnection // Output stream from transprot private DataOutputStream _outStream; + // A buffer used to construct the packet data + private ByteArrayOutputStream _bytes; + + // A DataOutputStream for the byte buffer + private DataOutputStream _doStream; + /** * Creates a new <code>JdwpConnection</code> instance * @@ -91,6 +101,8 @@ public class JdwpConnection _transport = transport; _commandQueue = new ArrayList (); _shutdown = false; + _bytes = new ByteArrayOutputStream (); + _doStream = new DataOutputStream (_bytes); } /** @@ -241,7 +253,7 @@ public class JdwpConnection * Send a packet to the debugger * * @param pkt a <code>JdwpPacket</code> to send - * @throws TransportException + * @throws IOException */ public void sendPacket (JdwpPacket pkt) throws IOException @@ -251,6 +263,28 @@ public class JdwpConnection } /** + * Send an event notification to the debugger + * + * @param request the debugger request that wanted this event + * @param event the event + * @throws IOException + */ + public void sendEvent (EventRequest request, Event event) + throws IOException + { + JdwpPacket pkt; + + synchronized (_bytes) + { + _bytes.reset (); + pkt = event.toPacket (_doStream, request); + pkt.setData (_bytes.toByteArray ()); + } + + sendPacket (pkt); + } + + /** * Shutdown the connection */ public void shutdown () |