users@websocket-spec.java.net

[jsr356-users] RemoteEndpoint.send*(…) methods and ByteBuffer[]

From: Norman Maurer <nmaurer_at_redhat.com>
Date: Fri, 8 Feb 2013 09:47:29 +0100

Hi,

I wonder if it would be possible to add another method for every RemoteEndPoint.send*(..) method that takes a ByteBuffer. The new method should look the same but take a ByteBuffer[] as argument .

So for example add this method:

void sendBytesByCompletion(ByteBuffer[] data, SendHandler completion);


It would allow the user to reuse ByteBuffer and combine a few to one payload without the need to allocate a new one that can hold the whole payload, This also gives better support for Buffer pools with fixed size buffers.
Implementations could then use gathering writes if they are based on NIO to write them out in an efficient manner. If not based on NIO it should be easy for them to just handle it by copy the contents.

---
Norman Maurer
nmaurer_at_redhat.com
JBoss, by Red Hat