This class adapts primitive type arrays to a base byte array so that the classes can inter-operate on the same base byte array without copying data. More...
#include <src/main/decaf/internal/util/ByteArrayAdapter.h>
Data Structures | |
| union | Array |
Public Member Functions | |
| ByteArrayAdapter (int size) | |
| Creates a byte array object that is allocated internally and is then owned and deleted when this object is deleted. | |
| ByteArrayAdapter (unsigned char *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (char *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (double *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (float *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (long long *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (int *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| ByteArrayAdapter (short *array, int size, bool own=false) | |
| Creates a byte array object that wraps the given array. | |
| virtual | ~ByteArrayAdapter () |
| virtual int | getCapacity () const |
| Gets the size of the underlying array. | |
| virtual int | getCharCapacity () const |
| Gets the size of the underlying array as if it contains chars. | |
| virtual int | getDoubleCapacity () const |
| Gets the size of the underlying array as if it contains doubles. | |
| virtual int | getFloatCapacity () const |
| Gets the size of the underlying array as if it contains doubles. | |
| virtual int | getLongCapacity () const |
| Gets the size of the underlying array as if it contains doubles. | |
| virtual int | getIntCapacity () const |
| Gets the size of the underlying array as if it contains ints. | |
| virtual int | getShortCapacity () const |
| Gets the size of the underlying array as if it contains shorts. | |
| virtual unsigned char * | getByteArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual char * | getCharArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual short * | getShortArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual int * | getIntArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual long long * | getLongArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual double * | getDoubleArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual float * | getFloatArray () |
| Gets the pointer to the array we are wrapping. | |
| virtual void | read (unsigned char *buffer, int size, int offset, int length) const |
| Reads from the Byte array starting at the specified offset and reading the specified length. | |
| virtual void | write (unsigned char *buffer, int size, int offset, int length) |
| Writes from the Byte array given, starting at the specified offset and writing the specified amount of data into this objects internal array. | |
| virtual void | resize (int size) |
| Resizes the underlying array to the new given size, preserving all the Data that was previously in the array, unless the resize is smaller than the current size in which case only the data that will fit into the new array is preserved. | |
| virtual void | clear () |
| Clear all data from that Array, setting the underlying bytes to zero. | |
| unsigned char & | operator[] (int index) |
| Allows the ByteArrayAdapter to be indexed as a standard array. | |
| const unsigned char & | operator[] (int index) const |
| virtual unsigned char | get (int index) const |
| Absolute get method. | |
| virtual char | getChar (int index) const |
| Reads one byte at the given index and returns it. | |
| virtual double | getDouble (int index) const |
| Reads eight bytes at the given index and returns it. | |
| virtual double | getDoubleAt (int index) const |
| Reads eight bytes at the given byte index and returns it. | |
| virtual float | getFloat (int index) const |
| Reads four bytes at the given index and returns it. | |
| virtual float | getFloatAt (int index) const |
| Reads four bytes at the given byte index and returns it. | |
| virtual long long | getLong (int index) const |
| Reads eight bytes at the given index and returns it. | |
| virtual long long | getLongAt (int index) const |
| Reads eight bytes at the given byte index and returns it. | |
| virtual int | getInt (int index) const |
| Reads four bytes at the given index and returns it. | |
| virtual int | getIntAt (int index) const |
| Reads four bytes at the given byte index and returns it. | |
| virtual short | getShort (int index) const |
| Reads two bytes at the given index and returns it. | |
| virtual short | getShortAt (int index) const |
| Reads two bytes at the given byte index and returns it. | |
| virtual ByteArrayAdapter & | put (int index, unsigned char value) |
| Writes the given byte into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putChar (int index, char value) |
| Writes one byte containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putDouble (int index, double value) |
| Writes eight bytes containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putDoubleAt (int index, double value) |
| Writes eight bytes containing the given value, into this buffer at the given byte index. | |
| virtual ByteArrayAdapter & | putFloat (int index, float value) |
| Writes four bytes containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putFloatAt (int index, float value) |
| Writes four bytes containing the given value, into this buffer at the given byte index. | |
| virtual ByteArrayAdapter & | putLong (int index, long long value) |
| Writes eight bytes containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putLongAt (int index, long long value) |
| Writes eight bytes containing the given value, into this buffer at the given byte index. | |
| virtual ByteArrayAdapter & | putInt (int index, int value) |
| Writes four bytes containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putIntAt (int index, int value) |
| Writes four bytes containing the given value, into this buffer at the given byte index. | |
| virtual ByteArrayAdapter & | putShort (int index, short value) |
| Writes two bytes containing the given value, into this buffer at the given index. | |
| virtual ByteArrayAdapter & | putShortAt (int index, short value) |
| Writes two bytes containing the given value, into this buffer at the given byte index. | |
This class adapts primitive type arrays to a base byte array so that the classes can inter-operate on the same base byte array without copying data.
All the array types are mapped down to a byte array and methods are supplied for accessing the data in any of the primitive type forms.
Methods in this class that do not return a specific value return a reference to this object so that calls can be chained.
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | int | size | ) |
Creates a byte array object that is 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. |
| IllegalArgumentException | if size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | unsigned char * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | char * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | double * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | float * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | long long * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | int * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| decaf::internal::util::ByteArrayAdapter::ByteArrayAdapter | ( | short * | array, | |
| int | size, | |||
| bool | own = false | |||
| ) |
Creates a byte array 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 physical array to wrap. | |
| size | The size of the array, this is the limit we read and write to. | |
| own | Indicates if this class is now the owner of the pointer. |
| NullPointerException | if buffer is NULL | |
| IndexOutOfBoundsException | if the size is negative. |
| virtual decaf::internal::util::ByteArrayAdapter::~ByteArrayAdapter | ( | ) | [virtual] |
| virtual void decaf::internal::util::ByteArrayAdapter::clear | ( | ) | [virtual] |
Clear all data from that Array, setting the underlying bytes to zero.
| virtual unsigned char decaf::internal::util::ByteArrayAdapter::get | ( | int | index | ) | const [virtual] |
Absolute get method.
Reads the byte at the given index.
| index | The index in the Buffer where the byte is to be read. |
| IndexOutOfBoundsException | If index is not smaller than the buffer's limit or is negative. |
| virtual unsigned char* decaf::internal::util::ByteArrayAdapter::getByteArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual int decaf::internal::util::ByteArrayAdapter::getCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array.
| virtual char decaf::internal::util::ByteArrayAdapter::getChar | ( | int | index | ) | const [virtual] |
Reads one byte at the given index and returns it.
| index | The index in the Buffer where the byte is to be read. |
| IndexOutOfBoundsException | If index is not smaller than the buffer's limit or is negative. |
| virtual char* decaf::internal::util::ByteArrayAdapter::getCharArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual int decaf::internal::util::ByteArrayAdapter::getCharCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains chars.
| virtual double decaf::internal::util::ByteArrayAdapter::getDouble | ( | int | index | ) | const [virtual] |
Reads eight bytes at the given index and returns it.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The index in the Buffer where the bytes are to be read. |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual double* decaf::internal::util::ByteArrayAdapter::getDoubleArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual double decaf::internal::util::ByteArrayAdapter::getDoubleAt | ( | int | index | ) | const [virtual] |
Reads eight bytes at the given byte index and returns it.
| index | The index in the Buffer where the bytes are to be read |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int decaf::internal::util::ByteArrayAdapter::getDoubleCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains doubles.
| virtual float decaf::internal::util::ByteArrayAdapter::getFloat | ( | int | index | ) | const [virtual] |
Reads four bytes at the given index and returns it.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The index in the Buffer where the bytes are to be read. |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual float* decaf::internal::util::ByteArrayAdapter::getFloatArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual float decaf::internal::util::ByteArrayAdapter::getFloatAt | ( | int | index | ) | const [virtual] |
Reads four bytes at the given byte index and returns it.
| index | The index in the Buffer where the bytes are to be read |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int decaf::internal::util::ByteArrayAdapter::getFloatCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains doubles.
| virtual int decaf::internal::util::ByteArrayAdapter::getInt | ( | int | index | ) | const [virtual] |
Reads four bytes at the given index and returns it.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The index in the Buffer where the bytes are to be read. |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int* decaf::internal::util::ByteArrayAdapter::getIntArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual int decaf::internal::util::ByteArrayAdapter::getIntAt | ( | int | index | ) | const [virtual] |
Reads four bytes at the given byte index and returns it.
| index | The index in the Buffer where the bytes are to be read |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int decaf::internal::util::ByteArrayAdapter::getIntCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains ints.
| virtual long long decaf::internal::util::ByteArrayAdapter::getLong | ( | int | index | ) | const [virtual] |
Reads eight bytes at the given index and returns it.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The index in the Buffer where the bytes are to be read. |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual long long* decaf::internal::util::ByteArrayAdapter::getLongArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual long long decaf::internal::util::ByteArrayAdapter::getLongAt | ( | int | index | ) | const [virtual] |
Reads eight bytes at the given byte index and returns it.
| index | The index in the Buffer where the bytes are to be read |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int decaf::internal::util::ByteArrayAdapter::getLongCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains doubles.
| virtual short decaf::internal::util::ByteArrayAdapter::getShort | ( | int | index | ) | const [virtual] |
Reads two bytes at the given index and returns it.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The index in the Buffer where the bytes are to be read. |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual short* decaf::internal::util::ByteArrayAdapter::getShortArray | ( | ) | [inline, virtual] |
Gets the pointer to the array we are wrapping.
Changes to the data in this array are reflected by all ByteArrayAdapter objects that point to this array.
| virtual short decaf::internal::util::ByteArrayAdapter::getShortAt | ( | int | index | ) | const [virtual] |
Reads two bytes at the given byte index and returns it.
| index | The index in the Buffer where the bytes are to be read |
| IndexOutOfBoundsException | if there are not enough bytes remaining to fill the requested Data Type, or index is negative. |
| virtual int decaf::internal::util::ByteArrayAdapter::getShortCapacity | ( | ) | const [inline, virtual] |
Gets the size of the underlying array as if it contains shorts.
| const unsigned char& decaf::internal::util::ByteArrayAdapter::operator[] | ( | int | index | ) | const |
| unsigned char& decaf::internal::util::ByteArrayAdapter::operator[] | ( | int | index | ) |
Allows the ByteArrayAdapter to be indexed as a standard array.
calling the non constant version allows the user to change the value at index
| index | The position in the array to access, if the value is negative or greater than the size of the underlying array an IndexOutOfBoundsException is thrown. |
| IndexOutOfBoundsException | if the preconditions of index are not met. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::put | ( | int | index, | |
| unsigned char | value | |||
| ) | [virtual] |
Writes the given byte into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putChar | ( | int | index, | |
| char | value | |||
| ) | [virtual] |
Writes one byte containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putDouble | ( | int | index, | |
| double | value | |||
| ) | [virtual] |
Writes eight bytes containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putDoubleAt | ( | int | index, | |
| double | value | |||
| ) | [virtual] |
Writes eight bytes containing the given value, into this buffer at the given byte index.
| index | The position in the Buffer to write the data. | |
| value | The value to write. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putFloat | ( | int | index, | |
| float | value | |||
| ) | [virtual] |
Writes four bytes containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putFloatAt | ( | int | index, | |
| float | value | |||
| ) | [virtual] |
Writes four bytes containing the given value, into this buffer at the given byte index.
| index | The position in the Buffer to write the data. | |
| value | The value to write. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putInt | ( | int | index, | |
| int | value | |||
| ) | [virtual] |
Writes four bytes containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putIntAt | ( | int | index, | |
| int | value | |||
| ) | [virtual] |
Writes four bytes containing the given value, into this buffer at the given byte index.
| index | The position in the Buffer to write the data. | |
| value | The value to write. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putLong | ( | int | index, | |
| long long | value | |||
| ) | [virtual] |
Writes eight bytes containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putLongAt | ( | int | index, | |
| long long | value | |||
| ) | [virtual] |
Writes eight bytes containing the given value, into this buffer at the given byte index.
| index | The position in the Buffer to write the data. | |
| value | The value to write. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putShort | ( | int | index, | |
| short | value | |||
| ) | [virtual] |
Writes two bytes containing the given value, into this buffer at the given index.
The index is a relative to the size of the type to be read, in other words when accessing the element in the array index * sizeof( type ) if the actual start index of the type to be read.
| index | The position in the Buffer to write the data. | |
| value | The value to write to the array. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual ByteArrayAdapter& decaf::internal::util::ByteArrayAdapter::putShortAt | ( | int | index, | |
| short | value | |||
| ) | [virtual] |
Writes two bytes containing the given value, into this buffer at the given byte index.
| index | The position in the Buffer to write the data. | |
| value | The value to write. |
| IndexOutOfBoundsException | if index greater than the buffer's limit minus the size of the type being written, or index is negative. |
| virtual void decaf::internal::util::ByteArrayAdapter::read | ( | unsigned char * | buffer, | |
| int | size, | |||
| int | offset, | |||
| int | length | |||
| ) | const [virtual] |
Reads from the Byte array starting at the specified offset and reading the specified length.
If the length is greater than the size of this underlying byte array then an BufferUnderflowException is thrown.
| buffer | The buffer to read data from this array into. | |
| size | The size of the buffer passed. | |
| offset | The position in this array to start reading from. | |
| length | The amount of data to read from this array. |
| IndexOutOfBoundsException | if the offset + length exceeds the size. | |
| NullPointerException | if buffer is null | |
| BufferUnderflowException | if there is not enough data to read because the offset or the length is greater than the size of this array. |
| virtual void decaf::internal::util::ByteArrayAdapter::resize | ( | int | size | ) | [virtual] |
Resizes the underlying array to the new given size, preserving all the Data that was previously in the array, unless the resize is smaller than the current size in which case only the data that will fit into the new array is preserved.
A ByteArrayAdapter can only be resized when it owns the underlying array, if it does not then it will throw an InvalidStateException.
| size | The new size of the array. |
| IllegalArgumentException | if the size parameter is negative. | |
| InvalidStateException | if this object does not own the buffer. |
| virtual void decaf::internal::util::ByteArrayAdapter::write | ( | unsigned char * | buffer, | |
| int | size, | |||
| int | offset, | |||
| int | length | |||
| ) | [virtual] |
Writes from the Byte array given, starting at the specified offset and writing the specified amount of data into this objects internal array.
. If the length is greater than the size of this underlying byte array then an BufferOverflowException is thrown.
| buffer | The buffer to read data from this array into. | |
| size | The size of the buffer passed. | |
| offset | The position in this array to start reading from. | |
| length | The amount of data to read from this array. |
| IndexOutOfBoundsException | if the offset + length exceeds the size. | |
| NullPointerException | if buffer is null | |
| BufferOverflowException | if the amount of data to be written to this array or the offset given are larger than this array's size. |
1.6.1