Android ShortBuffer Create createShortBuffer(short[] shortData)

Here you can find the source of createShortBuffer(short[] shortData)

Description

create Short Buffer

Declaration

public static final ShortBuffer createShortBuffer(short[] shortData) 

Method Source Code

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import java.nio.ShortBuffer;

public class Main {
    public static final int BYTES_PER_SHORT = 2;

    public static final ShortBuffer createShortBuffer(short[] shortData) {
        ShortBuffer buffer = ByteBuffer
                .allocateDirect(shortData.length * BYTES_PER_SHORT)
                .order(ByteOrder.nativeOrder()).asShortBuffer()
                .put(shortData);/*from ww w.java2 s.  c o m*/
        buffer.position(0);
        return buffer;
    }
}

Related

  1. createShortBuffer(int capacity)
  2. createShortBuffer(int shortCount)
  3. createShortBuffer(int size)
  4. createShortBuffer(int size)
  5. createShortBuffer(short[] data)
  6. createShortIndicesBuffer( final int capacity)
  7. createShortIndicesBuffer( final int capacity, final ShortBuffer previous)
  8. newShortBuffer(int numShorts)
  9. newShortBuffer(int numShorts)