java.nio
public abstract class Buffer extends Object
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Retrieves the capacity of the buffer.
|
Buffer |
clear()
Clears the buffer.
|
Buffer |
flip()
Flips the buffer.
|
boolean |
hasRemaining()
Tells whether the buffer has remaining data to read or not.
|
abstract boolean |
isReadOnly()
Tells whether this buffer is read only or not.
|
int |
limit()
Retrieves the current limit of the buffer.
|
Buffer |
limit(int newLimit)
Sets this buffer's limit.
|
Buffer |
mark()
Sets this buffer's mark at its position.
|
int |
position()
Retrieves the current position of this buffer.
|
Buffer |
position(int newPosition)
Sets this buffer's position.
|
int |
remaining()
Returns the number of elements between the current position and the limit.
|
Buffer |
reset()
Resets this buffer's position to the previously-marked position.
|
Buffer |
rewind()
Rewinds this buffer.
|
public final int capacity()
public final boolean hasRemaining()
public abstract boolean isReadOnly()
public final int limit()
public final Buffer limit(int newLimit)
newLimit
- The new limit value; must be non-negative and no larger
than this buffer's capacity.IllegalArgumentException
- If the preconditions on newLimit
do not hold.public final int position()
public final Buffer position(int newPosition)
newPosition
- The new position value; must be non-negative and no
larger than the current limit.IllegalArgumentException
- If the preconditions on newPosition
do not holdpublic final int remaining()
public final Buffer reset()
InvalidMarkException
- If the mark has not been set.