[RFA/JDWP] Event basics
Cedric Berger
cedric@berger.to
Wed Jun 22 21:56:00 GMT 2005
Keith Seitz wrote:
>Fact is, I haven't seen java.nio used much (it's all new to me).
>
>
Yeah, It is new in jdk 1.4, but this "new" api is not supposed to
replace the "old" one.
It is a lower-level API, somewhat less user-friendly, but faster and
more powerful
for this kind of packet-based, low-level applications. Also, you don't
need to use
threads, you've the C "poll()" function available.
>I presume you mean a ByteBuffer?
>
>
Yes.
>I'll have to keep that in mind for any outstanding work. Perhaps I'll
>just get what I have finished and then switch everything over in one
>fell swoop.
>
>
Makes sense. Actually, it wouldn't be that difficult to update the
code. The
toPacket could be replaced to write directly to a buffer, so it actually
becomes
much simpler, no more exceptions, allocations, ...
public void toPacket(ByteBuffer bb, int requestId, byte suspendPolicy)
{
bb.put(suspendPolicy);
bb.putInt(1);
bb.put(_eventKind);
bb.putInt(requestId);
_writeData(bb);
}
Cedric
More information about the Java-patches
mailing list