I have an array of longs
I want to write to disk. The most efficient disk I/O functions take in byte arrays, for example:
FileOutputStream.write(by
OP here.
I have thought of one approach: ByteBuffer.asLongBuffer()
returns an instance of ByteBufferAsLongBufferB, a class which wraps ByteBuffer in an interface for treating the data as long
s while properly managing endianness. I could extend ByteBufferAsLongBufferB
, and add a method to return the raw byte buffer (which is protected
).
But this seems so esoteric and convoluted I feel there must be an easier way. Either that, or something in my approach is flawed.