Java ByteBuffer to Int toInt16BE(ByteBuffer buf, int[] out)

Here you can find the source of toInt16BE(ByteBuffer buf, int[] out)

Description

to Int BE

License

BSD License

Declaration

private static int toInt16BE(ByteBuffer buf, int[] out) 

Method Source Code

//package com.java2s;
/**//from   w w  w  .ja  v a2 s. c  o m
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

import java.nio.ByteBuffer;

public class Main {
    private static int toInt16BE(ByteBuffer buf, int[] out) {
        int samples = 0;
        while (buf.remaining() >= 2 && samples < out.length) {
            out[samples++] = (short) (((buf.get() & 0xff) << 8) | (buf.get() & 0xff));
        }
        return samples;
    }
}

Related

  1. readVarIntRest(ByteBuffer buff, int b)
  2. toInt(ByteBuffer buffer)
  3. toInt(ByteBuffer buffer)
  4. toInt(ByteBuffer bytes)
  5. toInt(ByteBuffer value)