rebuild.comp.java.nio
Class Buffer

java.lang.Object
  extended by rebuild.comp.java.nio.Buffer
Direct Known Subclasses:
ByteBuffer, ShortBuffer

public abstract class Buffer
extends java.lang.Object

A container for data of a specific primitive type. Based off J2SE java.nio.Buffer class but no source code used for it.

Since:
BBX 1.2.0

Method Summary
 int capacity()
          Returns this buffer's capacity.
 Buffer clear()
          Clears this buffer.
 Buffer flip()
          Flips this buffer.
 boolean hasRemaining()
          Tells whether there are any elements between the current position and the limit.
 int limit()
          Returns this buffer's limit.
 Buffer limit(int newLimit)
          Sets this buffer's limit.
 int position()
          Returns this buffer's position.
 Buffer position(int newPosition)
          Sets this buffer's position.
 int remaining()
          Returns the number of elements between the current position and the limit.
 Buffer rewind()
          Rewinds this buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

limit

public final int limit()
Returns this buffer's limit.

Returns:
The limit of this buffer.

position

public final int position()
Returns this buffer's position.

Returns:
The position of this buffer.

position

public final Buffer position(int newPosition)
Sets this buffer's position.

Parameters:
newPosition - The new position value; must be non-negative and no larger than the current limit.
Returns:
This buffer.

remaining

public final int remaining()
Returns the number of elements between the current position and the limit.

Returns:
The number of elements remaining in this buffer.

flip

public final Buffer flip()
Flips this buffer.

Returns:
this buffer.

capacity

public final int capacity()
Returns this buffer's capacity.

Returns:
The capacity of this buffer.

limit

public final Buffer limit(int newLimit)
Sets this buffer's limit.

Parameters:
newLimit - the new limit value.
Returns:
this buffer.

rewind

public final Buffer rewind()
Rewinds this buffer.

Returns:
this buffer.

hasRemaining

public final boolean hasRemaining()
Tells whether there are any elements between the current position and the limit.

Returns:
true if, and only if, there is at least one element remaining in this buffer.

clear

public final Buffer clear()
Clears this buffer.

Returns:
this buffer.