the biggest problem on java arrays , they require copying to edit. I am using AMD Aparapi , which i get byte array from my calculations. I need to show that byte array as a bytebuffer "without copying"
byte aparapiData[];
ByteBuffer buffer;
...
//here bytebuffer
buffer.clear();
buffer.put(aparapiData);
buffer.flip();
socket.write(buffer);
The problem here on code , buffer.put is copying byte array to bytebuffer. And also there is reverse problem to convert byte array to bytebuffer.
Are they really require copying data? I can send pure data on C++ without copying.
How can i solve this issue on Java ?
socket.write(aparapiData)
?byte aparapiData[]
should really bebyte[] aparapiData
; the fact that it's an array is part of the data type, not the name.