Android ShortBuffer Create getShortBuffer(short[] list)

Here you can find the source of getShortBuffer(short[] list)

Description

Produce un ShortBuffer a partir de una lista de shorts

Parameter

Parameter Description
lista de shorts

Return

ShortBuffer resultante

Declaration

public static ShortBuffer getShortBuffer(short[] list) 

Method Source Code

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

import java.nio.ShortBuffer;

public class Main {
    /**/*from  w w  w .  jav a  2 s .  com*/
     * Produce un ShortBuffer a partir de una lista de shorts
     * @param lista de shorts
     * @return ShortBuffer resultante
     */
    public static ShortBuffer getShortBuffer(short[] list) {
        ByteBuffer bb = ByteBuffer.allocateDirect(list.length * Short.SIZE
                / 8);
        bb.order(ByteOrder.nativeOrder());
        ShortBuffer sb = bb.asShortBuffer();

        sb.put(list);
        sb.position(0);
        return sb;
    }
}

Related

  1. makeShortBuffer(short[] arr)
  2. createDirectShortBuffer( final int capacity)
  3. createDirectShortBuffer( final int capacity, final ShortBuffer previous)
  4. buildShortBuffer(short[] buffer)
  5. asShortBuffer(short[] array)
  6. toShortBuffer(short[] array)
  7. shotToBuffer(short[] a)
  8. setupShortBuffer(ShortBuffer preBuffer, short[] array)
  9. wrap(short[] buffer)