I am porting some of the java code and need to be able to flip (javax.nio.Buffer.flip()).
I am using byte[] to store data, and I want to flip these byte array, much like Buffer does it, as I believe underneath Buffer class uses byte[] as well.
Thanks
ByteBuffermay use abyte[](create from, say,ByteBuffer.wrap) or non-Java heap memory (created withByteBuffer.allocateDirect). You can get the underlyingbyte[]withByteBuffer.array. But callingflipand similar methods on buffers does not chnage the actual data. Instead offsets associated with the data are changed. So the equivalent withbytewould be to change the offsets that your code is associating with it.