Java ByteBuffer to Int Array readIntArray(ByteBuffer buf)

Here you can find the source of readIntArray(ByteBuffer buf)

Description

No array length

License

Open Source License

Parameter

Parameter Description
buf a parameter
arr a parameter

Declaration

public static int[] readIntArray(ByteBuffer buf) 

Method Source Code

//package com.java2s;
/*******************************************************************************
* Copyright (c) 2013 Vladimir Rodionov. All Rights Reserved
*
* This code is released under the GNU Affero General Public License.
*
* See: http://www.fsf.org/licensing/licenses/agpl-3.0.html
*
* VLADIMIR RODIONOV MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
* OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT. Vladimir Rodionov SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED
* BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR
* ITS DERIVATIVES.//from ww w .j a  v  a2s .c  o  m
*
* Author: Vladimir Rodionov
*
*******************************************************************************/

import java.nio.ByteBuffer;

public class Main {
    /**
     * No array length
     * @param buf
     * @param arr
     */
    public static int[] readIntArray(ByteBuffer buf) {
        final int size = buf.getInt();
        int[] arr = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = buf.getInt();
        }
        return arr;
    }
}

Related

  1. getIntegerFromBuffer(ByteBuffer buffer, int offset, int size)
  2. getIntFromBack(ByteBuffer bb)
  3. getIntFromByteBuffer(ByteBuffer data)
  4. getIntWithChecksum(ByteBuffer buffer, Adler32 checksum)
  5. readIntArray(ByteBuffer bb)
  6. readIntArray(ByteBuffer in)
  7. readIntegerArray(ByteBuffer bb, int length)