List of usage examples for java.nio DoubleBuffer get
public DoubleBuffer get(double[] dest, int off, int len)
From source file:Main.java
public static void main(String[] args) { DoubleBuffer bb = DoubleBuffer.allocate(BSIZE); bb.put(98765);/* ww w .j a va 2 s . co m*/ bb.put(98765); bb.put(98765); bb.put(98765); bb.put(98765); bb.rewind(); double[] doubleArray = new double[BSIZE]; bb.get(doubleArray, 0, 2); System.out.println(Arrays.toString(doubleArray)); }
From source file:org.cytobank.fcs_files.events.MemoryEvents.java
public MemoryEvents(File doubleFile) throws IOException, MemoryEventsException { this.doubleFile = doubleFile; numberOfEvents = (int) doubleFile.length() / BYTES_PER_DOUBLE; setupMemoryEventsArray(numberOfEvents); try {//from w w w . j a v a 2 s. co m // Read in the doubles file FileInputStream fileInputStream = new FileInputStream(doubleFile); FileChannel fileChannel = fileInputStream.getChannel(); MappedByteBuffer mappedByteBuffer = fileChannel.map(MapMode.READ_ONLY, 0, doubleFile.length()); DoubleBuffer doubleBuffer = mappedByteBuffer.asDoubleBuffer(); doubleBuffer.get(events, 0, numberOfEvents); fileChannel.close(); fileInputStream.close(); } catch (IOException ioe) { destroy(); throw ioe; } openedAt = System.currentTimeMillis(); }