|
libcommonc++
0.7
|
An implementation of Buffer representing a Java direct buffer. More...
#include <JavaBuffer.h++>


Public Member Functions | |
| JavaBuffer (JavaVirtualMachine *jvm, size_t size) | |
| Construct a new JavaBuffer. More... | |
| ~JavaBuffer () | |
| Destructor. More... | |
| void | setSize (size_t newSize) |
| jobject | getJavaObject () |
| Get the JVM object representing the Java direct buffer. More... | |
| virtual void | clear () |
| Clear the buffer. More... | |
| void | flip () |
| Flip the buffer. More... | |
| void | rewind () |
| Rewind the buffer. More... | |
| void | setLimit (uint_t limit) |
| Set the limit. More... | |
| void | setPosition (uint_t pos) |
| Set the position. More... | |
| uint_t | bump (uint_t delta) |
| Bump (advance) the position by the given number of elements, or to the limit, whichever occurs first. More... | |
| uint_t | skip (uint_t delta) |
| Advance the position by the given number of elements, or to the limit, whichever occurs first, filling the "skipped" elements with zeroes. More... | |
| bool | put (const T &item) |
| Copy an item into the buffer at the current position and bump the position by 1. More... | |
| bool | put (const T *items, uint_t count) |
| Copy an array of items into the buffer starting at the current position, and bump the position by the number of items. More... | |
| bool | get (T *item) |
| Copy an item from the buffer at the current position and bump the position by 1. More... | |
| bool | get (T *items, uint_t count) |
| Copy an array of items from the buffer starting at the current position, and bump the position by the number of items. More... | |
| void | fill (const T &item, uint_t count=0) |
| Fill the buffer with a given item. More... | |
| int | peek (const T &item) const |
| Scan forward from the current position for an element equal to the given value. More... | |
| T * | getPointer () |
| Get a pointer to the element at the current position. More... | |
| const T * | getPointer () const |
| Get a pointer to the next element to be read or written. More... | |
| uint_t | getLimit () const |
| Get the limit. More... | |
| uint_t | getRemaining () const |
| Get the number of elements available to be read or written. More... | |
| bool | hasRemaining () const |
| Test if there are any elements available to be read or written. More... | |
| uint_t | getPosition () const |
| Get the position of the next element to be read or written. More... | |
| T & | operator[] (int index) |
| Get a reference to the element at the specified index. More... | |
| T | operator[] (int index) const |
| Get a copy of the element at the specified index. More... | |
| virtual void | setSize (uint_t newSize) |
| Resize the buffer. More... | |
| uint_t | getSize () const |
| Get the size of the buffer. More... | |
| T * | getBase () |
| Get a pointer to the base of the buffer. More... | |
| const T * | getBase () const |
| Get a pointer to the base of the buffer. More... | |
Protected Attributes | |
| uint_t | _limit |
| The limit. More... | |
| uint_t | _pos |
| The position. More... | |
| T * | _data |
| A pointer to the raw buffer. More... | |
| uint_t | _size |
| The size of the buffer. More... | |
| bool | _owner |
| Whether this object owns the raw buffer. More... | |
An implementation of Buffer representing a Java direct buffer.
| JavaBuffer | ( | JavaVirtualMachine * | jvm, |
| size_t | size | ||
| ) |
Construct a new JavaBuffer.
| jvm | The JavaVirtualMachine in which the buffer is being created. |
| size | The size of the buffer, in bytes. |
| JavaException | If the buffer cannot be constructed. |
| ~JavaBuffer | ( | ) |
Destructor.
Bump (advance) the position by the given number of elements, or to the limit, whichever occurs first.
| delta | The number of elements. |
|
virtualinherited |
Clear the buffer.
Sets the position to 0 and the limit to the end of the buffer.
Reimplemented from AbstractBuffer< T >.
|
inherited |
Fill the buffer with a given item.
| item | The item to fill with. |
| count | The number of elements to fill. If 0 or greater than the number of elements before the limit, the buffer is filled up to the limit. |
|
inherited |
Flip the buffer.
Sets the limit to the current position, and the position to 0.
|
inherited |
Copy an item from the buffer at the current position and bump the position by 1.
| item | The item. |
|
inherited |
Copy an array of items from the buffer starting at the current position, and bump the position by the number of items.
| items | The items to copy into. |
| count | The number of items. |
|
inlineinherited |
Get a pointer to the base of the buffer.
|
inlineinherited |
Get a pointer to the base of the buffer.
|
inline |
Get the JVM object representing the Java direct buffer.
|
inlineinherited |
Get the limit.
|
inlineinherited |
Get a pointer to the element at the current position.
|
inlineinherited |
Get a pointer to the next element to be read or written.
|
inlineinherited |
Get the position of the next element to be read or written.
|
inlinevirtualinherited |
Get the number of elements available to be read or written.
Implements AbstractBuffer< T >.
|
inlineinherited |
Get the size of the buffer.
|
inlinevirtualinherited |
Test if there are any elements available to be read or written.
Reimplemented from AbstractBuffer< T >.
|
inherited |
Get a reference to the element at the specified index.
| index | The index of the element. |
| OutOfBoundsException | If the index is out of bounds. |
|
inherited |
Get a copy of the element at the specified index.
| index | The index of the element. |
| OutOfBoundsException | If the index is out of bounds. |
|
inherited |
Scan forward from the current position for an element equal to the given value.
| item | The item to scan for. |
|
inherited |
Copy an item into the buffer at the current position and bump the position by 1.
| item | The item. |
|
inherited |
Copy an array of items into the buffer starting at the current position, and bump the position by the number of items.
| items | The items to place in the buffer. |
| count | The number of items. |
|
inherited |
Rewind the buffer.
Sets the position to 0.
|
inherited |
Set the limit.
|
inherited |
Set the position.
|
virtualinherited |
Resize the buffer.
| newSize | The new size, in elements. |
| UnsupportedOperationException | If this object does not own the underlying byte buffer. |
Reimplemented in CircularBuffer< T >, CircularBuffer< C >, and CircularBuffer< byte_t >.
| void setSize | ( | size_t | newSize | ) |
| JavaException | If the buffer cannot be resized. |
Advance the position by the given number of elements, or to the limit, whichever occurs first, filling the "skipped" elements with zeroes.
| delta | The number of elements. |
|
protectedinherited |
A pointer to the raw buffer.
|
protectedinherited |
The limit.
|
protectedinherited |
Whether this object owns the raw buffer.
|
protectedinherited |
The position.
|
protectedinherited |
The size of the buffer.