IntBuffer

public abstract class IntBuffer extends Buffer
implements Comparable<IntBuffer>

An int buffer.

This class defines four categories of operations upon int buffers:

  • Absolute and relative get and put methods that read and write single ints;

  • Relative bulk get methods that transfer contiguous sequences of ints from this buffer into an array; and

  • Relative bulk put methods that transfer contiguous sequences of ints from an int array or some other int buffer into this buffer; and

  • Methods for compacting, duplicating, and slicing an int buffer.

Int buffers can be created either by allocation, which allocates space for the buffer's content, by wrapping an existing int array into a buffer, or by creating a view of an existing byte buffer.

Like a byte buffer, an int buffer is either direct or non-direct. A int buffer created via the wrap methods of this class will be non-direct. An int buffer created as a view of a byte buffer will be direct if, and only if, the byte buffer itself is direct. Whether or not an int buffer is direct may be determined by invoking the isDirect method.

Methods in this class that do not otherwise have a value to return are specified to return the buffer upon which they are invoked. This allows method invocations to be chained.

Public Method Summary

static IntBuffer
allocate(int capacity)
Allocates a new int buffer.
final int[]
array()
Returns the int array that backs this buffer  (optional operation).
final int
arrayOffset()
Returns the offset within this buffer's backing array of the first element of the buffer  (optional operation).
abstract IntBuffer
asReadOnlyBuffer()
Creates a new, read-only int buffer that shares this buffer's content.
abstract IntBuffer
compact()
Compacts this buffer  (optional operation).
int
compareTo(IntBuffer that)
Compares this buffer to another.
abstract IntBuffer
duplicate()
Creates a new int buffer that shares this buffer's content.
boolean
equals(Object ob)
Tells whether or not this buffer is equal to another object.
abstract int
get()
Relative get method.
abstract int
get(int index)
Absolute get method.
IntBuffer
get(int[] dst, int offset, int length)
Relative bulk get method.
IntBuffer
get(int[] dst)
Relative bulk get method.
final boolean
hasArray()
Tells whether or not this buffer is backed by an accessible int array.
int
hashCode()
Returns the current hash code of this buffer.
abstract boolean
isDirect()
Tells whether or not this int buffer is direct.
abstract ByteOrder
order()
Retrieves this buffer's byte order.
abstract IntBuffer
put(int i)
Relative put method  (optional operation).
IntBuffer
put(int[] src, int offset, int length)
Relative bulk put method  (optional operation).
abstract IntBuffer
put(int index, int i)
Absolute put method  (optional operation).
final IntBuffer
put(int[] src)
Relative bulk put method  (optional operation).
IntBuffer
put(IntBuffer src)
Relative bulk put method  (optional operation).
abstract IntBuffer
slice()
Creates a new int buffer whose content is a shared subsequence of this buffer's content.
String
toString()
Returns a string summarizing the state of this buffer.
static IntBuffer
wrap(int[] array)
Wraps an int array into a buffer.
static IntBuffer
wrap(int[] array, int offset, int length)
Wraps an int array into a buffer.

Inherited Method Summary