Public Member Functions |
virtual | ~IntBuffer () |
virtual std::string | toString () const |
virtual int * | array ()=0 |
| Returns the int array that backs this buffer (optional operation).
|
virtual int | arrayOffset ()=0 |
| Returns the offset within this buffer's backing array of the first element of the buffer (optional operation).
|
virtual IntBuffer * | asReadOnlyBuffer () const =0 |
| Creates a new, read-only int buffer that shares this buffer's content.
|
virtual IntBuffer & | compact ()=0 |
| Compacts this buffer.
|
virtual IntBuffer * | duplicate ()=0 |
| Creates a new int buffer that shares this buffer's content.
|
virtual int | get ()=0 |
| Relative get method.
|
virtual int | get (int index) const =0 |
| Absolute get method.
|
IntBuffer & | get (std::vector< int > buffer) |
| Relative bulk get method.
|
IntBuffer & | get (int *buffer, int size, int offset, int length) |
| Relative bulk get method.
|
virtual bool | hasArray () const =0 |
| Tells whether or not this buffer is backed by an accessible int array.
|
IntBuffer & | put (IntBuffer &src) |
| This method transfers the ints remaining in the given source buffer into this buffer.
|
IntBuffer & | put (const int *buffer, int size, int offset, int length) |
| This method transfers ints into this buffer from the given source array.
|
IntBuffer & | put (std::vector< int > &buffer) |
| This method transfers the entire content of the given source ints array into this buffer.
|
virtual IntBuffer & | put (int value)=0 |
| Writes the given integer into this buffer at the current position, and then increments the position.
|
virtual IntBuffer & | put (int index, int value)=0 |
| Writes the given ints into this buffer at the given index.
|
virtual IntBuffer * | slice () const =0 |
| Creates a new IntBuffer whose content is a shared subsequence of this buffer's content.
|
virtual int | compareTo (const IntBuffer &value) const |
|
|
virtual bool | equals (const IntBuffer &value) const |
|
|
virtual bool | operator== (const IntBuffer &value) const |
|
|
virtual bool | operator< (const IntBuffer &value) const |
|
|
| Buffer (int capactiy) |
| Buffer (const Buffer &other) |
virtual | ~Buffer () |
virtual int | capacity () const |
virtual int | position () const |
virtual Buffer & | position (int newPosition) |
| Sets this buffer's position.
|
virtual int | limit () const |
virtual Buffer & | limit (int newLimit) |
| Sets this buffer's limit.
|
virtual Buffer & | mark () |
| Sets this buffer's mark at its position.
|
virtual Buffer & | reset () |
| Resets this buffer's position to the previously-marked position.
|
virtual Buffer & | clear () |
| Clears this buffer.
|
virtual Buffer & | flip () |
| Flips this buffer.
|
virtual Buffer & | rewind () |
| Rewinds this buffer.
|
virtual int | remaining () const |
| Returns the number of elements between the current position and the limit.
|
virtual bool | hasRemaining () const |
| Tells whether there are any elements between the current position and the limit.
|
virtual bool | isReadOnly () const =0 |
| Tells whether or not this buffer is read-only.
|
virtual | ~Comparable () |
virtual int | compareTo (const IntBuffer &value) const =0 |
| Compares this object with the specified object for order.
|
virtual bool | equals (const IntBuffer &value) const =0 |
virtual bool | operator== (const IntBuffer &value) const =0 |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const IntBuffer &value) const =0 |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
This class defines four categories of operations upon int buffers:
o Absolute and relative get and put methods that read and write single ints; o Relative bulk get methods that transfer contiguous sequences of ints from this buffer into an array; and o Relative bulk put methods that transfer contiguous sequences of ints from a int array or some other int buffer into this buffer o Methods for compacting, duplicating, and slicing a int buffer.
Double 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
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.
virtual IntBuffer* decaf::nio::IntBuffer::asReadOnlyBuffer |
( |
| ) |
const |
|
pure virtual |
Creates a new, read-only int buffer that shares this buffer's content.
The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.
If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.
The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer.
- Returns
- The new, read-only int buffer which the caller then owns.
Implemented in decaf::internal::nio::IntArrayBuffer.
virtual IntBuffer& decaf::nio::IntBuffer::compact |
( |
| ) |
|
|
pure virtual |
Compacts this buffer.
The bytes between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the byte at index p = position() is copied to index zero, the byte at index p + 1 is copied to index one, and so forth until the byte at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.
The buffer's position is set to the number of bytes copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.
- Returns
- a reference to this IntBuffer
- Exceptions
-
Implemented in decaf::internal::nio::IntArrayBuffer.
virtual IntBuffer* decaf::nio::IntBuffer::duplicate |
( |
| ) |
|
|
pure virtual |
Creates a new int buffer that shares this buffer's content.
The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.
The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer. The new buffer will be read-only if, and only if, this buffer is read-only.
- Returns
- a new int Buffer which the caller owns.
Implemented in decaf::internal::nio::IntArrayBuffer.
IntBuffer& decaf::nio::IntBuffer::get |
( |
int * |
buffer, |
|
|
int |
size, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
Relative bulk get method.
This method transfers ints from this buffer into the given destination array. If there are fewer ints remaining in the buffer than are required to satisfy the request, that is, if length > remaining(), then no bytes are transferred and a BufferUnderflowException is thrown.
Otherwise, this method copies length ints from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by length.
- Parameters
-
buffer | The pointer to an allocated buffer to fill. |
size | The size of the buffer that was passed in. |
offset | The position in the buffer to start filling. |
length | The amount of data to put in the passed buffer. |
- Returns
- a reference to this Buffer.
- Exceptions
-
BufferUnderflowException | if there are fewer than length ints remaining in this buffer. |
NullPointerException | if the passed buffer is null. |
IndexOutOfBoundsException | if the preconditions of size, offset, or length are not met. |
This method transfers the ints remaining in the given source buffer into this buffer.
If there are more ints remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no ints are transferred and a BufferOverflowException is thrown.
Otherwise, this method copies n = src.remaining() ints from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.
- Parameters
-
src | The buffer to take ints from an place in this one. |
- Returns
- a reference to this buffer.
- Exceptions
-
IntBuffer& decaf::nio::IntBuffer::put |
( |
const int * |
buffer, |
|
|
int |
size, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
This method transfers ints into this buffer from the given source array.
If there are more ints to be copied from the array than remain in this buffer, that is, if length > remaining(), then no ints are transferred and a BufferOverflowException is thrown.
Otherwise, this method copies length bytes from the given array into this buffer, starting at the given offset in the array and at the current position of this buffer. The position of this buffer is then incremented by length.
- Parameters
-
buffer | The array from which integers are to be read. |
size | The size of the buffer passed. |
offset | The offset within the array of the first char to be read. |
length | The number of integers to be read from the given array. |
- Returns
- a reference to this buffer.
- Exceptions
-
BufferOverflowException | if there is insufficient space in this buffer. |
ReadOnlyBufferException | if this buffer is read-only. |
NullPointerException | if the passed buffer is null. |
IndexOutOfBoundsException | if the preconditions of size, offset, or length are not met. |
virtual IntBuffer* decaf::nio::IntBuffer::slice |
( |
| ) |
const |
|
pure virtual |
Creates a new IntBuffer whose content is a shared subsequence of this buffer's content.
The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.
The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
- Returns
- the newly create IntBuffer which the caller owns.
Implemented in decaf::internal::nio::IntArrayBuffer.
static IntBuffer* decaf::nio::IntBuffer::wrap |
( |
int * |
array, |
|
|
int |
size, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
|
static |
Wraps the passed buffer with a new IntBuffer.
The new buffer will be backed by the given int array; that is, modifications to the buffer will cause the array to be modified and vice versa. The new buffer's capacity will be array.length, its position will be offset, its limit will be offset + length, and its mark will be undefined. Its backing array will be the given array, and its array offset will be zero.
- Parameters
-
array | The array that will back the new buffer. |
size | The size of the passed in array. |
offset | The offset of the subarray to be used. |
length | The length of the subarray to be used. |
- Returns
- a new IntBuffer that is backed by buffer, caller owns.
- Exceptions
-
NullPointerException | if the array pointer is NULL. |
IndexOutOfBoundsException | if the preconditions of size, offset, or length are not met. |