Example usage for java.nio DoubleBuffer mark

List of usage examples for java.nio DoubleBuffer mark

Introduction

In this page you can find the example usage for java.nio DoubleBuffer 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 copyDoubleBufferAsByteBuffer(DoubleBuffer buf) {
    ByteBuffer dest = newByteBuffer(buf.remaining() * SIZEOF_DOUBLE);
    buf.mark();
    dest.asDoubleBuffer().put(buf);//from  w  w w  . j  a  v  a2  s . co m
    buf.reset();
    dest.rewind();
    return dest;
}