Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.nio

Class Buffer

java.lang.Object
|
+--java.nio.Buffer


public abstract class Buffer

extends Object

Field Summary

intcap

Capacity of the buffer.

Method Summary

intcapacity()

Retrieves the capacity of the buffer.
java.nio.Bufferclear()

Clears the buffer.
java.nio.Bufferflip()

Flips the buffer.
booleanhasRemaining()

Tells whether the buffer has remaining data to read or not.
booleanisReadOnly()

Tells whether this buffer is read only or not.
intlimit()

Retrieves the current limit of the buffer.
java.nio.Bufferlimit(int newLimit)

Sets this buffer's limit.
java.nio.Buffermark()

Sets this buffer's mark at its position.
intposition()

Retrieves the current position of this buffer.
java.nio.Bufferposition(int newPosition)

Sets this buffer's position.
intremaining()

Returns the number of elements between the current position and the limit.
java.nio.Bufferreset()

Resets this buffer's position to the previously-marked position.
java.nio.Bufferrewind()

Rewinds this buffer.

Field Details

cap

protected int cap

Capacity of the buffer. XXX - FIXME - should not be protected but (package) private


Method Details

capacity

public final int capacity()

Retrieves the capacity of the buffer.


clear

public final Buffer clear()

Clears the buffer.


flip

public final Buffer flip()

Flips the buffer.


hasRemaining

public final boolean hasRemaining()

Tells whether the buffer has remaining data to read or not.


isReadOnly

public boolean isReadOnly()

Tells whether this buffer is read only or not.


limit

public final int limit()

Retrieves the current limit of the buffer.


limit

public final Buffer limit(int newLimit)

Sets this buffer's limit.

Parameters:

Throws:


mark

public final Buffer mark()

Sets this buffer's mark at its position.


position

public final int position()

Retrieves the current position of this buffer.


position

public final Buffer position(int newPosition)

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

Parameters:

Throws:


remaining

public final int remaining()

Returns the number of elements between the current position and the limit.


reset

public final Buffer reset()

Resets this buffer's position to the previously-marked position.

Throws:


rewind

public final Buffer rewind()

Rewinds this buffer. The position is set to zero and the mark is discarded.