I'm currently converting a Delphi method used for random binary file access into Java. The Delphi procedure uses:
TSingleArray = Array[0..MAXSIZE] of Single
...
procedure GetLinkValues(const LinkVar: Integer; const TimePeriod: Integer; var Value: PSingleArray);
...
BlockRead(Fout, Value^, Nlinks*SizeOf(Single));
To read an array of bytes into an array of Single. Is there an equivalent way of doing this in Java without iterating through the array?
I’m currently using
List<Float> l = new ArrayList<Float>();
…
for (int i = 0 ; i < nLinks ; i++ )
l.add( resultsFile.readFloat());
But I’m concerned about speed. Endianness is not a problem.