#include <src/main/decaf/internal/nio/IntArrayBuffer.h>

Public Member Functions | |||||||||||||
| IntArrayBuffer (int size, bool readOnly=false) | |||||||||||||
| Creates a IntArrayBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted. | |||||||||||||
| IntArrayBuffer (int *array, int size, int offset, int length, bool readOnly=false) | |||||||||||||
| Creates a IntArrayBuffer object that wraps the given array. | |||||||||||||
| IntArrayBuffer (const decaf::lang::Pointer< ByteArrayAdapter > &array, int offset, int length, bool readOnly=false) | |||||||||||||
| Creates a byte buffer that wraps the passed ByteArrayAdapter and start at the given offset. | |||||||||||||
| IntArrayBuffer (const IntArrayBuffer &other) | |||||||||||||
| Create a IntArrayBuffer that mirrors this one, meaning it shares a reference to this buffers ByteArrayAdapter and when changes are made to that data it is reflected in both. | |||||||||||||
| virtual | ~IntArrayBuffer () | ||||||||||||
| virtual int * | array () | ||||||||||||
Returns the int array that backs this buffer (optional operation).Modifications to this buffer's content will cause the returned array's content to be modified, and vice versa.Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
| |||||||||||||
| virtual int | arrayOffset () | ||||||||||||
Returns the offset within this buffer's backing array of the first element of the buffer (optional operation).Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
| |||||||||||||
| virtual IntBuffer * | asReadOnlyBuffer () const | ||||||||||||
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.
| |||||||||||||
| virtual IntBuffer & | compact () | ||||||||||||
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.
| |||||||||||||
| virtual IntBuffer * | duplicate () | ||||||||||||
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.
| |||||||||||||
| virtual int | get () | ||||||||||||
Relative get method.Reads the value at this buffer's current position, and then increments the position.
| |||||||||||||
| virtual int | get (int index) const | ||||||||||||
Absolute get method.Reads the value at the given index.
| |||||||||||||
| virtual bool | hasArray () const | ||||||||||||
Tells whether or not this buffer is backed by an accessible int array.If this method returns true then the array and arrayOffset methods may safely be invoked. Subclasses should override this method if they do not have a backing array as this class always returns true.
| |||||||||||||
| virtual bool | isReadOnly () const | ||||||||||||
Tells whether or not this buffer is read-only.
| |||||||||||||
| virtual IntBuffer & | put (int value) | ||||||||||||
Writes the given integer into this buffer at the current position, and then increments the position.
| |||||||||||||
| virtual IntBuffer & | put (int index, int value) | ||||||||||||
Writes the given ints into this buffer at the given index.
| |||||||||||||
| virtual IntBuffer * | slice () const | ||||||||||||
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.
| |||||||||||||
Protected Member Functions | |||||||||||||
| virtual void | setReadOnly (bool value) | ||||||||||||
| Sets this IntArrayBuffer as Read-Only. | |||||||||||||
| decaf::internal::nio::IntArrayBuffer::IntArrayBuffer | ( | int | size, | |
| bool | readOnly = false | |||
| ) |
Creates a IntArrayBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.
The array is initially created with all elements initialized to zero.
| size | The size of the array, this is the limit we read and write to. | |
| readOnly | Boolean indicating if this buffer should be read-only, default as false. |
| IllegalArguementException | if the capacity value is negative. |
| decaf::internal::nio::IntArrayBuffer::IntArrayBuffer | ( | int * | array, | |
| int | size, | |||
| int | offset, | |||
| int | length, | |||
| bool | readOnly = false | |||
| ) |
Creates a IntArrayBuffer object that wraps the given array.
If the own flag is set then it will delete this array when this object is deleted.
| array | The actual array to wrap. | |
| size | The size of the given array. | |
| offset | The position that is this buffers start position. | |
| length | The limit of how many bytes into the array this Buffer can write. | |
| readOnly | Boolean indicating if this buffer should be read-only, default as false. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if offset is greater than array capacity. |
| decaf::internal::nio::IntArrayBuffer::IntArrayBuffer | ( | const decaf::lang::Pointer< ByteArrayAdapter > & | array, | |
| int | offset, | |||
| int | length, | |||
| bool | readOnly = false | |||
| ) |
Creates a byte buffer that wraps the passed ByteArrayAdapter and start at the given offset.
The capacity and limit of the new IntArrayBuffer will be that of the remaining capacity of the passed buffer.
| array | The ByteArrayAdapter to wrap. | |
| offset | The position that is this buffers start position. | |
| length | The limit of how many bytes into the array this Buffer can write. | |
| readOnly | Boolean indicating if this buffer should be read-only, default as false. |
| NullPointerException | if array is NULL | |
| IndexOutOfBoundsException | if offset + length is greater than array size. |
| decaf::internal::nio::IntArrayBuffer::IntArrayBuffer | ( | const IntArrayBuffer & | other | ) |
Create a IntArrayBuffer that mirrors this one, meaning it shares a reference to this buffers ByteArrayAdapter and when changes are made to that data it is reflected in both.
| other | The IntArrayBuffer this one is to mirror. |
| virtual decaf::internal::nio::IntArrayBuffer::~IntArrayBuffer | ( | ) | [virtual] |
| virtual int* decaf::internal::nio::IntArrayBuffer::array | ( | ) | [virtual] |
Returns the int array that backs this buffer (optional operation).Modifications to this buffer's content will cause the returned array's content to be modified, and vice versa.Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
| ReadOnlyBufferException | if this Buffer is read only. | |
| UnsupportedOperationException | if the underlying store has no array. |
Implements decaf::nio::IntBuffer.
| virtual int decaf::internal::nio::IntArrayBuffer::arrayOffset | ( | ) | [virtual] |
Returns the offset within this buffer's backing array of the first element of the buffer (optional operation).Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
| ReadOnlyBufferException | if this Buffer is read only. | |
| UnsupportedOperationException | if the underlying store has no array. |
Implements decaf::nio::IntBuffer.
| virtual IntBuffer* decaf::internal::nio::IntArrayBuffer::asReadOnlyBuffer | ( | ) | const [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.
Implements decaf::nio::IntBuffer.
| virtual IntBuffer& decaf::internal::nio::IntArrayBuffer::compact | ( | ) | [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.
| ReadOnlyBufferException | if this buffer is read-only. |
Implements decaf::nio::IntBuffer.
| virtual IntBuffer* decaf::internal::nio::IntArrayBuffer::duplicate | ( | ) | [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.
Implements decaf::nio::IntBuffer.
| virtual int decaf::internal::nio::IntArrayBuffer::get | ( | int | index | ) | const [virtual] |
Absolute get method.Reads the value at the given index.
| index | The index in the Buffer where the int is to be read. |
| IndexOutOfBoundsException | if index is not smaller than the buffer's limit, or index is negative. |
Implements decaf::nio::IntBuffer.
| virtual int decaf::internal::nio::IntArrayBuffer::get | ( | ) | [virtual] |
Relative get method.Reads the value at this buffer's current position, and then increments the position.
| BufferUnderflowException | if there no more data to return. |
Implements decaf::nio::IntBuffer.
| virtual bool decaf::internal::nio::IntArrayBuffer::hasArray | ( | ) | const [inline, virtual] |
Tells whether or not this buffer is backed by an accessible int array.If this method returns true then the array and arrayOffset methods may safely be invoked. Subclasses should override this method if they do not have a backing array as this class always returns true.
Implements decaf::nio::IntBuffer.
| virtual bool decaf::internal::nio::IntArrayBuffer::isReadOnly | ( | ) | const [inline, virtual] |
Tells whether or not this buffer is read-only.
Implements decaf::nio::Buffer.
| virtual IntBuffer& decaf::internal::nio::IntArrayBuffer::put | ( | int | index, | |
| int | value | |||
| ) | [virtual] |
Writes the given ints into this buffer at the given index.
| index | The position in the Buffer to write the data. | |
| value | The ints to write. |
| IndexOutOfBoundsException | - If index greater than the buffer's limit minus the size of the type being written, or the index is negative. | |
| ReadOnlyBufferException | - If this buffer is read-only. |
Implements decaf::nio::IntBuffer.
| virtual IntBuffer& decaf::internal::nio::IntArrayBuffer::put | ( | int | value | ) | [virtual] |
Writes the given integer into this buffer at the current position, and then increments the position.
| value | The integer value to be written. |
| BufferOverflowException | if this buffer's current position is not smaller than its limit. | |
| ReadOnlyBufferException | if this buffer is read-only. |
Implements decaf::nio::IntBuffer.
| virtual void decaf::internal::nio::IntArrayBuffer::setReadOnly | ( | bool | value | ) | [inline, protected, virtual] |
Sets this IntArrayBuffer as Read-Only.
| value | Boolean value, true if this buffer is to be read-only, false otherwise. |
| virtual IntBuffer* decaf::internal::nio::IntArrayBuffer::slice | ( | ) | const [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.
Implements decaf::nio::IntBuffer.
1.6.1