Skip to main content

[jsr356-experts] ByteBuffers versus Byte Arrays

  • From: Bill Wigger < >
  • To:
  • Subject: [jsr356-experts] ByteBuffers versus Byte Arrays
  • 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



[jsr356-experts] ByteBuffers versus Byte Arrays

Bill Wigger 08/10/2012

[jsr356-experts] Re: ByteBuffers versus Byte Arrays

Wenbo Zhu 08/11/2012

[jsr356-experts] Re: ByteBuffers versus Byte Arrays

Justin Lee 08/11/2012

[jsr356-experts] Re: ByteBuffers versus Byte Arrays

Greg Wilkins 08/11/2012
 
 
Close
loading
Please Confirm
Close