Example usage for java.nio ShortBuffer asReadOnlyBuffer

List of usage examples for java.nio ShortBuffer asReadOnlyBuffer

Introduction

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

Prototype

public abstract ShortBuffer asReadOnlyBuffer();

Source Link

Document

Returns a read-only buffer that shares its content with this buffer.

Usage

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();//from w  w  w  . ja  v a 2 s. c om

    ShortBuffer shortBuffer2 = shortBuffer.asReadOnlyBuffer();

    System.out.println(Arrays.toString(shortBuffer2.array()));

}