Created
March 6, 2013 22:03
-
-
Save lgordon/5103515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static float[] getFloatC(String filename) | |
throws FileNotFoundException, IOException{ | |
File fl = new File(filename); | |
FileInputStream str = new FileInputStream(fl); | |
FileChannel ch = str.getChannel(); | |
MappedByteBuffer mb = ch.map( FileChannel.MapMode.READ_ONLY, 0L, ch.size( )); | |
int numfloats = (int) ch.size()/4; | |
float[] result = new float [numfloats]; | |
try{ | |
for(int j=0;j<numfloats;j++){ | |
result [j] = mb.getFloat(); | |
} | |
} finally{ | |
str.close(); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment