Example usage for java.nio FloatBuffer mark

List of usage examples for java.nio FloatBuffer mark

Introduction

In this page you can find the example usage for java.nio FloatBuffer mark.

Prototype

public final Buffer mark() 

Source Link

Document

Marks the current position, so that the position may return to this point later by calling reset().

Usage

From source file:Main.java

public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer buf) {
    ByteBuffer dest = newByteBuffer(buf.remaining() * SIZEOF_FLOAT);
    buf.mark();
    dest.asFloatBuffer().put(buf);/*  www  . j  a  v a2 s .  co  m*/
    buf.reset();
    dest.rewind();
    return dest;
}