users@websocket-spec.java.net

[jsr356-users] [jsr356-experts] Re: ByteBuffers versus Byte Arrays

From: Justin Lee <jlee_at_antwerkz.com>
Date: Fri, 10 Aug 2012 22:16:22 -0400

Since EE 7 is targeting java 7 and I think we agreed to as well, I don't
ByteBuffer will be a problem. Certainly people still using 1.4 don't
deserve any consideration. :)

On Fri, Aug 10, 2012 at 8:17 PM, Wenbo Zhu <wenboz_at_google.com> wrote:

>
>
> On Fri, Aug 10, 2012 at 12:54 PM, 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.
>>
> I'd support using ByteBuffer too, to avoid unnecessary copy. Our pre-spec
> API started with ByteBuffer, but then switched to byte[] as we have legacy
> ByteBuffer-like types written pre 1.4 ;)
>
>
>
>>
>> regards,
>> Bill
>>
>> Bill Wigger
>> Software Development
>> IBM Research Triangle Park
>>
>>
>


-- 
You can find me on the net at:
http://antwerkz.com             http://antwerkz.com/+
http://antwerkz.com/twitter   http://antwerkz.com/github