C
Chris
I need to read several large arrays of integers off a disk into int []
variables.
I could read them into byte[] arrays and then convert, doing lots of
masks and bitshifting. I can't help but believe there's a faster way.
I've fooled with NIO, thinking that I could create an IntBuffer and read
stuff into it using FileChannel.read(), but no go. I don't think it will
work to create a ByteBuffer, read data into it, and then call
asIntBuffer() on it, because the .array() method I need to return the
int [] is described as an "optional operation" in the Javadoc.
Any other ideas how to do it?
variables.
I could read them into byte[] arrays and then convert, doing lots of
masks and bitshifting. I can't help but believe there's a faster way.
I've fooled with NIO, thinking that I could create an IntBuffer and read
stuff into it using FileChannel.read(), but no go. I don't think it will
work to create a ByteBuffer, read data into it, and then call
asIntBuffer() on it, because the .array() method I need to return the
int [] is described as an "optional operation" in the Javadoc.
Any other ideas how to do it?