Android ByteBuffer Get shorts(ByteBuffer buffer)

Here you can find the source of shorts(ByteBuffer buffer)




public static short[] shorts(ByteBuffer buffer) 

Method Source Code

//package com.java2s;

import java.nio.ByteBuffer;

import java.nio.ShortBuffer;

public class Main {
    public static short[] shorts(ByteBuffer buffer) {
        ShortBuffer samples = buffer.asShortBuffer();
        short[] shorts = new short[samples.limit()];
        for (int i = 0; i < samples.limit(); i++)
            shorts[i] = samples.get(i);//from  ww w.  j  av a2  s. c o  m
        return shorts;


  1. getUnsignedInt(final ByteBuffer pByteBuffer)
  2. getUnsignedInt(final ByteBuffer pByteBuffer, final int pPosition)
  3. extractNullTerminatedString(ByteBuffer bb)
  4. allocateMore(ByteBuffer output)
  5. removeFirstBytes(ByteBuffer buffer, int num)
  6. getObject(ByteBuffer byteBuffer)
  7. skip(ByteBuffer buffer, int length)