activemq-cpp-3.6.0
decaf::internal::util::ByteArrayAdapter Class Reference

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 ByteArrayAdapterput (int index, unsigned char value)
 Writes the given byte into this buffer at the given index.
virtual ByteArrayAdapterputChar (int index, char value)
 Writes one byte containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputDouble (int index, double value)
 Writes eight bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputDoubleAt (int index, double value)
 Writes eight bytes containing the given value, into this buffer at the given byte index.
virtual ByteArrayAdapterputFloat (int index, float value)
 Writes four bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputFloatAt (int index, float value)
 Writes four bytes containing the given value, into this buffer at the given byte index.
virtual ByteArrayAdapterputLong (int index, long long value)
 Writes eight bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputLongAt (int index, long long value)
 Writes eight bytes containing the given value, into this buffer at the given byte index.
virtual ByteArrayAdapterputInt (int index, int value)
 Writes four bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputIntAt (int index, int value)
 Writes four bytes containing the given value, into this buffer at the given byte index.
virtual ByteArrayAdapterputShort (int index, short value)
 Writes two bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapterputShortAt (int index, short value)
 Writes two bytes containing the given value, into this buffer at the given byte index.

Detailed Description

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.

Since
1.0

Constructor & Destructor Documentation

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.

Parameters
sizeThe size of the array, this is the limit we read and write to.
Exceptions
IllegalArgumentExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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.

Parameters
arrayThe physical array to wrap.
sizeThe size of the array, this is the limit we read and write to.
ownIndicates if this class is now the owner of the pointer.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif the size is negative.
virtual decaf::internal::util::ByteArrayAdapter::~ByteArrayAdapter ( )
virtual

Member Function Documentation

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.

Parameters
indexThe index in the Buffer where the byte is to be read.
Returns
the byte that is located at the given index.
Exceptions
IndexOutOfBoundsExceptionIf index is not smaller than the buffer's limit or is negative.
virtual unsigned char* decaf::internal::util::ByteArrayAdapter::getByteArray ( )
inlinevirtual

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.

Returns
an unsigned char* pointer to the array this object wraps.
virtual int decaf::internal::util::ByteArrayAdapter::getCapacity ( ) const
inlinevirtual

Gets the size of the underlying array.

Returns
the size the array.
virtual char decaf::internal::util::ByteArrayAdapter::getChar ( int  index) const
virtual

Reads one byte at the given index and returns it.

Parameters
indexThe index in the Buffer where the byte is to be read.
Returns
the byte that is located at the given index.
Exceptions
IndexOutOfBoundsExceptionIf index is not smaller than the buffer's limit or is negative.
virtual char* decaf::internal::util::ByteArrayAdapter::getCharArray ( )
inlinevirtual

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.

Returns
an char* pointer to the array this object wraps.
virtual int decaf::internal::util::ByteArrayAdapter::getCharCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains chars.

Returns
the size the array.
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.

Parameters
indexThe index in the Buffer where the bytes are to be read.
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual double* decaf::internal::util::ByteArrayAdapter::getDoubleArray ( )
inlinevirtual

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.

Returns
an double* pointer to the array this object wraps.
virtual double decaf::internal::util::ByteArrayAdapter::getDoubleAt ( int  index) const
virtual

Reads eight bytes at the given byte index and returns it.

Parameters
indexThe index in the Buffer where the bytes are to be read
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int decaf::internal::util::ByteArrayAdapter::getDoubleCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains doubles.

Returns
the size the array.
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.

Parameters
indexThe index in the Buffer where the bytes are to be read.
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual float* decaf::internal::util::ByteArrayAdapter::getFloatArray ( )
inlinevirtual

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.

Returns
an float* pointer to the array this object wraps.
virtual float decaf::internal::util::ByteArrayAdapter::getFloatAt ( int  index) const
virtual

Reads four bytes at the given byte index and returns it.

Parameters
indexThe index in the Buffer where the bytes are to be read
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int decaf::internal::util::ByteArrayAdapter::getFloatCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains doubles.

Returns
the size the array.
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.

Parameters
indexThe index in the Buffer where the bytes are to be read.
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int* decaf::internal::util::ByteArrayAdapter::getIntArray ( )
inlinevirtual

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.

Returns
an int* pointer to the array this object wraps.
virtual int decaf::internal::util::ByteArrayAdapter::getIntAt ( int  index) const
virtual

Reads four bytes at the given byte index and returns it.

Parameters
indexThe index in the Buffer where the bytes are to be read
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int decaf::internal::util::ByteArrayAdapter::getIntCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains ints.

Returns
the size the array.
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.

Parameters
indexThe index in the Buffer where the bytes are to be read.
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual long long* decaf::internal::util::ByteArrayAdapter::getLongArray ( )
inlinevirtual

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.

Returns
an long long* pointer to the array this object wraps.
virtual long long decaf::internal::util::ByteArrayAdapter::getLongAt ( int  index) const
virtual

Reads eight bytes at the given byte index and returns it.

Parameters
indexThe index in the Buffer where the bytes are to be read
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int decaf::internal::util::ByteArrayAdapter::getLongCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains doubles.

Returns
the size the array.
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.

Parameters
indexThe index in the Buffer where the bytes are to be read.
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual short* decaf::internal::util::ByteArrayAdapter::getShortArray ( )
inlinevirtual

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.

Returns
an short* pointer to the array this object wraps.
virtual short decaf::internal::util::ByteArrayAdapter::getShortAt ( int  index) const
virtual

Reads two bytes at the given byte index and returns it.

Parameters
indexThe index in the Buffer where the bytes are to be read
Returns
the value at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif there are not enough bytes remaining to fill the requested Data Type, or index is negative.
virtual int decaf::internal::util::ByteArrayAdapter::getShortCapacity ( ) const
inlinevirtual

Gets the size of the underlying array as if it contains shorts.

Returns
the size the array.
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

Parameters
indexThe position in the array to access, if the value is negative or greater than the size of the underlying array an IndexOutOfBoundsException is thrown.
Exceptions
IndexOutOfBoundsExceptionif the preconditions of index are not met.
const unsigned char& decaf::internal::util::ByteArrayAdapter::operator[] ( int  index) const
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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write to the array.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
indexThe position in the Buffer to write the data.
valueThe value to write.
Returns
a reference to this buffer.
Exceptions
IndexOutOfBoundsExceptionif 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.

Parameters
bufferThe buffer to read data from this array into.
sizeThe size of the buffer passed.
offsetThe position in this array to start reading from.
lengthThe amount of data to read from this array.
Exceptions
IndexOutOfBoundsExceptionif the offset + length exceeds the size.
NullPointerExceptionif buffer is null
BufferUnderflowExceptionif 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.

Parameters
sizeThe new size of the array.
Exceptions
IllegalArgumentExceptionif the size parameter is negative.
InvalidStateExceptionif 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.

Parameters
bufferThe buffer to read data from this array into.
sizeThe size of the buffer passed.
offsetThe position in this array to start reading from.
lengthThe amount of data to read from this array.
Exceptions
IndexOutOfBoundsExceptionif the offset + length exceeds the size.
NullPointerExceptionif buffer is null
BufferOverflowExceptionif the amount of data to be written to this array or the offset given are larger than this array's size.

The documentation for this class was generated from the following file: