M
Matt Newcomb
G'day,
I've got a piece of hardware that writes 32 bit int's ( big endian )
into a direct ByteBuffer ( via a JNI call ). The data is organized
into frames 480 integers long. The code is running on a little endian
machine. I've been calling:
ByteBuffer inData;
nidaq.readData(inData)
inData.order(ByteOrder.littleEndian)
IntBuffer processData = inData.asIntBuffer()
Then calling buffer.get a bunch of times to copy one frame at a time
into an int[] for analysis.
I'm kind of new with java, and I wouldn't think you could do this with
a strongly typed language, but is there anyway to cast a byte[] to an
int[] to avoid all this copying of data? I'd like the extra
performance.
Thanks,
Matt
I've got a piece of hardware that writes 32 bit int's ( big endian )
into a direct ByteBuffer ( via a JNI call ). The data is organized
into frames 480 integers long. The code is running on a little endian
machine. I've been calling:
ByteBuffer inData;
nidaq.readData(inData)
inData.order(ByteOrder.littleEndian)
IntBuffer processData = inData.asIntBuffer()
Then calling buffer.get a bunch of times to copy one frame at a time
into an int[] for analysis.
I'm kind of new with java, and I wouldn't think you could do this with
a strongly typed language, but is there anyway to cast a byte[] to an
int[] to avoid all this copying of data? I'd like the extra
performance.
Thanks,
Matt