List of usage examples for java.nio DoubleBuffer hasArray
public final boolean hasArray()
From source file:Main.java
public static void main(String[] args) { DoubleBuffer bb = DoubleBuffer.allocate(BSIZE); bb.put(98765);/* w ww.ja va2 s . c o m*/ System.out.println(bb.hasArray()); }
From source file:Main.java
/** * Creates a double array from the provided {@link DoubleBuffer}. * /*from w w w . ja v a 2 s . c om*/ * @param buffer {@link DoubleBuffer} the data source. * @return double array containing the data of the buffer. */ public static double[] getDoubleArrayFromBuffer(DoubleBuffer buffer) { double[] array = null; if (buffer.hasArray()) { array = buffer.array(); } else { buffer.rewind(); array = new double[buffer.capacity()]; buffer.get(array); } return array; }