jsr356-experts@websocket-spec.java.net

[jsr356-experts] ByteBuffers versus Byte Arrays

From: Bill Wigger <wigger_at_us.ibm.com>
Date: Fri, 10 Aug 2012 15:54:25 -0400

It looks like the APIs for send* and onMessage* are defined to use byte
arrays. Can we use ByteBuffers instead of byte[] in these APIs? The
reason being is that byte[] are always allocated from heap memory, but
ByteBuffers can either be allocated, under the user's control, as nonDirect
(heap memory) or Direct (native memory). Sometimes it is advantageous for
the user to be using native memory and at least they should be given the
flexibility to do so. byte[] can be wrapped into ByteBuffers and retrieved
from ByteBuffers easily, so users can work with byte[] if they want to.

regards,
Bill

Bill Wigger
Software Development
IBM Research Triangle Park