Commit 1b0618bf by Keith Seitz Committed by Keith Seitz

JdwpConnection.java (sendEvent): New method.

        * gnu/classpath/jdwp/transport/JdwpConnection.java (sendEvent): New
        method.
        (_bytes): New member.
        (_doStream): New member.
        (JdwpConnection): Initialize new members.

From-SVN: r101471
parent 70d02430
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> 2005-06-29 Kelley Cook <kcook@gcc.gnu.org>
* all files: Update for new FSF address. * all files: Update for new FSF address.
......
...@@ -40,7 +40,10 @@ exception statement from your version. */ ...@@ -40,7 +40,10 @@ exception statement from your version. */
package gnu.classpath.jdwp.transport; package gnu.classpath.jdwp.transport;
import gnu.classpath.jdwp.Jdwp; 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.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -64,7 +67,8 @@ public class JdwpConnection ...@@ -64,7 +67,8 @@ public class JdwpConnection
extends Thread extends Thread
{ {
// The JDWP handshake // 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 // Transport method
private ITransport _transport; private ITransport _transport;
...@@ -81,6 +85,12 @@ public class JdwpConnection ...@@ -81,6 +85,12 @@ public class JdwpConnection
// Output stream from transprot // Output stream from transprot
private DataOutputStream _outStream; 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 * Creates a new <code>JdwpConnection</code> instance
* *
...@@ -91,6 +101,8 @@ public class JdwpConnection ...@@ -91,6 +101,8 @@ public class JdwpConnection
_transport = transport; _transport = transport;
_commandQueue = new ArrayList (); _commandQueue = new ArrayList ();
_shutdown = false; _shutdown = false;
_bytes = new ByteArrayOutputStream ();
_doStream = new DataOutputStream (_bytes);
} }
/** /**
...@@ -241,7 +253,7 @@ public class JdwpConnection ...@@ -241,7 +253,7 @@ public class JdwpConnection
* Send a packet to the debugger * Send a packet to the debugger
* *
* @param pkt a <code>JdwpPacket</code> to send * @param pkt a <code>JdwpPacket</code> to send
* @throws TransportException * @throws IOException
*/ */
public void sendPacket (JdwpPacket pkt) public void sendPacket (JdwpPacket pkt)
throws IOException throws IOException
...@@ -251,6 +263,28 @@ public class JdwpConnection ...@@ -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 * Shutdown the connection
*/ */
public void shutdown () public void shutdown ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment