See Also: Buffer
public abstract class Buffer : Object
A buffer is a list of elements of a specific primitive type.
A buffer can be described by the following properties:
- Capacity: the number of elements a buffer can hold. Capacity may not be negative and never changes.
- Position: a cursor of this buffer. Elements are read or written at the position if you do not specify an index explicitly. Position may not be negative and not greater than the limit.
- Limit: controls the scope of accessible elements. You can only read or write elements from index zero to limit - 1. Accessing elements out of the scope will cause an exception. Limit may not be negative and not greater than capacity.
- Mark: used to remember the current position, so that you can reset the position later. Mark may not be negative and no greater than position.
- A buffer can be read-only or read-write. Trying to modify the elements of a read-only buffer will cause a ReadOnlyBufferException, while changing the position, limit and mark of a read-only buffer is OK.
- A buffer can be direct or indirect. A direct buffer will try its best to take advantage of native memory APIs and it may not stay in the Java heap, thus it is not affected by garbage collection.
Buffers are not thread-safe. If concurrent access to a buffer instance is required, then the callers are responsible to take care of the synchronization issues.
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1
The members of Java.Nio.Buffer are listed below.
See Also: Object
|HasArray||Boolean. Returns true if array and arrayOffset won't throw.|
|[read-only]||HasRemaining||Boolean. Indicates if there are elements remaining in this buffer, that is if position .|
|IsDirect||Boolean. Returns true if this is a direct buffer.|
|IsReadOnly||Boolean. Indicates whether this buffer is read-only.|
Returns the offset into the array returned by array of the first element of the buffer (optional operation).
Returns the capacity of this buffer.
Clears this buffer.
Flips this buffer.
Returns the limit of this buffer.
Sets the limit of this buffer.
Marks the current position, so that the position may return to this point later by calling reset().
Returns the position of this buffer.
Sets the position of this buffer.
Returns the number of remaining elements in this buffer, that is limit - position.
Resets the position of this buffer to the mark.
Rewinds this buffer.