Android ShortBuffer Create wrap(short[] buffer)

Here you can find the source of wrap(short[] buffer)

Description

wrap

Declaration

public static ShortBuffer wrap(short[] buffer) 

Method Source Code

//package com.java2s;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

public class Main {

    public static FloatBuffer wrap(float[] buffer) {
        return (FloatBuffer) ByteBuffer.allocateDirect(buffer.length * 4)
                .order(ByteOrder.nativeOrder()).asFloatBuffer().put(buffer)
                .position(0);//from ww w  . j a  v a 2  s .com
    }

    public static ShortBuffer wrap(short[] buffer) {
        return (ShortBuffer) ByteBuffer.allocateDirect(buffer.length * 2)
                .order(ByteOrder.nativeOrder()).asShortBuffer().put(buffer)
                .position(0);
    }
}

Related

  1. asShortBuffer(short[] array)
  2. getShortBuffer(short[] list)
  3. toShortBuffer(short[] array)
  4. shotToBuffer(short[] a)
  5. setupShortBuffer(ShortBuffer preBuffer, short[] array)
  6. ConvToShortBuffer(short buf[])
  7. ConvToShortBuffer(short buf[])