I've got a bunch of float data in a FloatBuffer
which needs to be written to a file (without it taking three minutes). Currently a DataOutputStream
is used to write the FloatBuffer
element by element to a file. This is slow. Preferably, I'd like to be using a FileChannel
, but I hit a snag since it seems a FloatBuffer
can't be converted to a ByteBuffer
and bytes are what the FileChannel
needs in order to write data.
Instead of using FoatBuffers
as my data source, I could easily be using an array. But I can't easily use a ByteBuffer/array instead.
Any insight into this problem would be much appreciated. Thanks.