Example usage for java.nio ShortBuffer reset

List of usage examples for java.nio ShortBuffer reset

Introduction

In this page you can find the example usage for java.nio ShortBuffer reset.

Prototype

public final Buffer reset() 

Source Link

Document

Resets the position of this buffer to the mark.

Usage

From source file:Main.java

public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer buf) {
    ByteBuffer dest = newByteBuffer(buf.remaining() * SIZEOF_SHORT);
    buf.mark();/*  w  w w .  ja va 2s  .  c o m*/
    dest.asShortBuffer().put(buf);
    buf.reset();
    dest.rewind();
    return dest;
}