jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: ByteBuffers versus Byte Arrays

From: Greg Wilkins <gregw_at_intalio.com>
Date: Sat, 11 Aug 2012 12:02:50 +1000

+1

On 11 August 2012 05:54, Bill Wigger <wigger_at_us.ibm.com> wrote:

> 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
>
>


-- 
Greg Wilkins <gregw_at_intalio.com>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.