List of usage examples for java.nio FloatBuffer hasArray
public final boolean hasArray()
From source file:Main.java
public static void main(String[] args) { FloatBuffer floatBuffer = FloatBuffer.allocate(10); floatBuffer.put(1, 1.23F);/*from w ww.j a v a 2 s .c o m*/ System.out.println(floatBuffer.hasArray()); }
From source file:Main.java
/** * Creates a float array from the provided {@link FloatBuffer}. * //from w w w . ja v a 2s . c om * @param buffer {@link FloatBuffer} the data source. * @return float array containing the data of the buffer. */ public static float[] getFloatArrayFromBuffer(FloatBuffer buffer) { float[] array = null; if (buffer.hasArray()) { array = buffer.array(); } else { buffer.rewind(); array = new float[buffer.capacity()]; buffer.get(array); } return array; }