Java ByteBuffer Allocate allocateInt()

Here you can find the source of allocateInt()

Description

Get an IntBuffer of size 4 with Little Endian Byte Order

License

Open Source License

Return

an IntBuffer of size 4 with Little Endian byte order

Declaration

public static IntBuffer allocateInt() 

Method Source Code

//package com.java2s;
/*/* www  . j av  a 2  s .c  o m*/
 * Copyright (c) 2015 Westwood Robotics <code.westwoodrobotics@gmail.com>.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 */

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;

public class Main {
    /**
     * Get an IntBuffer of size 4 with Little Endian Byte Order
     * @return an IntBuffer of size 4 with Little Endian byte order
     */
    public static IntBuffer allocateInt() {
        ByteBuffer status = ByteBuffer.allocateDirect(4);
        status.order(ByteOrder.LITTLE_ENDIAN);
        return status.asIntBuffer();
    }
}

Related

  1. allocateDirect(int capacity)
  2. allocateDirectBuffer(int size)
  3. allocateDirectInt(int size)
  4. allocateDoubles(final int howmany, final int SIZE)
  5. allocateFloats(final int howmany, final int SIZE)
  6. allocateInts(final int[] intarray, final int SIZE)
  7. allocateNativeOrderDirectBuffer(int size)
  8. allocateTestBuffer(int capacity, boolean direct)
  9. fromBytes(byte[] data, boolean[] preAllocatedValues)