decaf::internal::nio::ByteArrayBuffer Class Reference

This class defines six categories of operations upon byte buffers:. More...

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

Inheritance diagram for decaf::internal::nio::ByteArrayBuffer:
Inheritance graph
[legend]

Public Member Functions

 ByteArrayBuffer (int capacity, bool readOnly=false)
 Creates a ByteArrayBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.
 ByteArrayBuffer (unsigned char *array, int size, int offset, int length, bool readOnly=false)
 Creates a ByteArrayBuffer object that wraps the given array.
 ByteArrayBuffer (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.
 ByteArrayBuffer (const ByteArrayBuffer &other)
 Create a ByteArrayBuffer 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 ~ByteArrayBuffer ()
virtual bool isReadOnly () const
 Tells whether or not this buffer is read-only.
Returns:
true if, and only if, this buffer is read-only

virtual unsigned char * array ()
 Returns the byte array that backs this buffer.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.
Returns:
The array that backs this buffer
Exceptions:
ReadOnlyBufferException if this buffer is backed by an array but is read-only
UnsupportedOperationException if this buffer is not backed by an accessible array

virtual int arrayOffset () const
 Returns the offset within this buffer's backing array of the first element of the buffer.If this buffer is backed by an array then buffer position p corresponds to array index p + arrayOffset().Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
Returns:
The offset within this buffer's array of the first element of the buffer.
Exceptions:
ReadOnlyBufferException if this buffer is backed by an array but is read-only.
UnsupportedOperationException if this buffer is not backed by an accessible array.

virtual bool hasArray () const
 Tells whether or not this buffer is backed by an accessible byte 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.
Returns:
true if, and only if, this buffer is backed by an array and is not read-only.

virtual decaf::nio::CharBufferasCharBuffer () const
 Creates a view of this byte buffer as a char buffer.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 new Char Buffer, which the caller then owns.

virtual decaf::nio::DoubleBufferasDoubleBuffer () const
 Creates a view of this byte buffer as a double buffer.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 divided by eight, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns:
the new double Buffer, which the caller then owns.

virtual decaf::nio::FloatBufferasFloatBuffer () const
 Creates a view of this byte buffer as a float buffer.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 divided by four, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns:
the new float Buffer, which the caller then owns.

virtual decaf::nio::IntBufferasIntBuffer () const
 Creates a view of this byte buffer as a int buffer.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 divided by four, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns:
the new int Buffer, which the caller then owns.

virtual decaf::nio::LongBufferasLongBuffer () const
 Creates a view of this byte buffer as a long buffer.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 divided by eight, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns:
the new long Buffer, which the caller then owns.

virtual decaf::nio::ShortBufferasShortBuffer () const
 Creates a view of this byte buffer as a short buffer.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 divided by two, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns:
the new short Buffer, which the caller then owns.

virtual ByteArrayBufferasReadOnlyBuffer () const
 Creates a new, read-only byte 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 byte buffer which the caller then owns.

virtual ByteArrayBuffercompact ()
 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 ByteBuffer.
Exceptions:
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferduplicate ()
 Creates a new byte 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 Byte Buffer which the caller owns.

virtual unsigned char get () const
 Relative get method.Reads the byte at this buffer's current position, and then increments the position.
Returns:
The byte at the buffer's current position.
Exceptions:
BufferUnderflowException if the buffer's current position is not smaller than its limit.

virtual unsigned char get (int index) const
 Absolute get method.Reads the byte at the given index.
Parameters:
index The index in the Buffer where the byte is to be read.
Returns:
the byte that is located at the given index.
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

virtual char getChar ()
 Reads the next byte at this buffer's current position, and then increments the position by one.
Returns:
the next char in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual char getChar (int index) const
 Reads one byte at the given index and returns it.
Parameters:
index The index in the Buffer where the byte is to be read.
Returns:
the char at the given index in the buffer
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

virtual double getDouble ()
 Reads the next eight bytes at this buffer's current position, and then increments the position by that amount.
Returns:
the next double in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual double getDouble (int index) const
 Reads eight bytes at the given index and returns it.
Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the double at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

virtual float getFloat ()
 Reads the next four bytes at this buffer's current position, and then increments the position by that amount.
Returns:
the next float in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual float getFloat (int index) const
 Reads four bytes at the given index and returns it.
Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the float at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

virtual long long getLong ()
 Reads the next eight bytes at this buffer's current position, and then increments the position by that amount.
Returns:
the next long long in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual long long getLong (int index) const
 Reads eight bytes at the given index and returns it.
Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the long long at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

virtual int getInt ()
 Reads the next four bytes at this buffer's current position, and then increments the position by that amount.
Returns:
the next int in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual int getInt (int index) const
 Reads four bytes at the given index and returns it.
Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the int at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

virtual short getShort ()
 Reads the next two bytes at this buffer's current position, and then increments the position by that amount.
Returns:
the next short in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

virtual short getShort (int index) const
 Reads two bytes at the given index and returns it.
Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the short at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

virtual ByteArrayBufferput (unsigned char value)
 Writes the given byte into this buffer at the current position, and then increments the position.
Parameters:
value - the byte value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if this buffer's current position is not smaller than its limit.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferput (int index, unsigned char value)
 Writes the given byte into this buffer at the given index.
Parameters:
index - position in the Buffer to write the data
value - the byte to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputChar (char value)
 Writes one byte containing the given value, into this buffer at the current position, and then increments the position by one.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

virtual ByteArrayBufferputChar (int index, char value)
 Writes one byte containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only

virtual ByteArrayBufferputDouble (double value)
 Writes eight bytes containing the given value, into this buffer at the current position, and then increments the position by eight.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

virtual ByteArrayBufferputDouble (int index, double value)
 Writes eight bytes containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputFloat (float value)
 Writes four bytes containing the given value, into this buffer at the current position, and then increments the position by eight.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputFloat (int index, float value)
 Writes four bytes containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputLong (long long value)
 Writes eight bytes containing the given value, into this buffer at the current position, and then increments the position by eight.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputLong (int index, long long value)
 Writes eight bytes containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputInt (int value)
 Writes four bytes containing the given value, into this buffer at the current position, and then increments the position by eight.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

virtual ByteArrayBufferputInt (int index, int value)
 Writes four bytes containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only

virtual ByteArrayBufferputShort (short value)
 Writes two bytes containing the given value, into this buffer at the current position, and then increments the position by eight.
Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferputShort (int index, short value)
 Writes two bytes containing the given value, into this buffer at the given index.
Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

virtual ByteArrayBufferslice () const
 Creates a new byte buffer 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 ByteBuffer which the caller owns.

Protected Member Functions

virtual void setReadOnly (bool value)
 Sets this ByteArrayBuffer as Read-Only or not Read-Only.

Detailed Description

This class defines six categories of operations upon byte buffers:.

1. Absolute and relative get and put methods that read and write single bytes; 2. Relative bulk get methods that transfer contiguous sequences of bytes from this buffer into an array; 3. Relative bulk put methods that transfer contiguous sequences of bytes from a byte array or some other byte buffer into this buffer; 4. Absolute and relative get and put methods that read and write values of other primitive types, translating them to and from sequences of bytes in a particular byte order; 5. Methods for creating view buffers, which allow a byte buffer to be viewed as a buffer containing values of some other primitive type; and 6. Methods for compacting, duplicating, and slicing a byte buffer.

Byte buffers can be created either by allocation, which allocates space for the buffer's content, or by wrapping an existing byte array into a buffer.

Access to binary data:

This class defines methods for reading and writing values of all other primitive types, except boolean. Primitive values are translated to (or from) sequences of bytes according to the buffer's current byte order.

For access to heterogeneous binary data, that is, sequences of values of different types, this class defines a family of absolute and relative get and put methods for each type. For 32-bit floating-point values, for example, this class defines:

float getFloat() float getFloat(int index) void putFloat(float f) void putFloat(int index, float f)

Corresponding methods are defined for the types char, short, int, long, and double. The index parameters of the absolute get and put methods are in terms of bytes rather than of the type being read or written.

For access to homogeneous binary data, that is, sequences of values of the same type, this class defines methods that can create views of a given byte buffer. A view buffer is simply another buffer whose content is backed by the byte buffer. Changes to the byte buffer's content will be visible in the view buffer, and vice versa; the two buffers' position, limit, and mark values are independent. The asFloatBuffer method, for example, creates an instance of the FloatBuffer class that is backed by the byte buffer upon which the method is invoked. Corresponding view-creation methods are defined for the types char, short, int, long, and double.

View buffers have two important advantages over the families of type-specific get and put methods described above:

A view buffer is indexed not in terms of bytes but rather in terms of the type-specific size of its values;

A view buffer provides relative bulk get and put methods that can transfer contiguous sequences of values between a buffer and an array or some other buffer of the same type; and

Since:
1.0

Constructor & Destructor Documentation

decaf::internal::nio::ByteArrayBuffer::ByteArrayBuffer ( int  capacity,
bool  readOnly = false 
)

Creates a ByteArrayBuffer 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.

Parameters:
capacity The size of the array, this is the limit we read and write to.
readOnly Should this buffer be read-only, default as false
Exceptions:
IllegalArguementException if the capacity value is negative.
decaf::internal::nio::ByteArrayBuffer::ByteArrayBuffer ( unsigned char *  array,
int  size,
int  offset,
int  length,
bool  readOnly = false 
)

Creates a ByteArrayBuffer object that wraps the given array.

Parameters:
array The array to wrap.
size The size of the array passed.
offset The position that is this buffers start position.
length The size of the sub-array, this is the limit we read and write to.
readOnly Should this buffer be read-only, default as false.
Exceptions:
NullPointerException if buffer is NULL
IndexOutOfBoundsException if the preconditions of size, offset and length are violated.
decaf::internal::nio::ByteArrayBuffer::ByteArrayBuffer ( 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 ByteArrayBuffer will be that of the remaining capacity of the passed buffer.

Parameters:
array The ByteArrayAdapter to wrap
offset The offset into array where the buffer starts
length The length of the array we are wrapping or limit.
readOnly Boolean indicating if this a readOnly buffer.
Exceptions:
NullPointerException if array is NULL
IndexOutOfBoundsException if offset is greater than array capacity.
decaf::internal::nio::ByteArrayBuffer::ByteArrayBuffer ( const ByteArrayBuffer other  ) 

Create a ByteArrayBuffer 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.

Parameters:
other The ByteArrayBuffer this one is to mirror.
virtual decaf::internal::nio::ByteArrayBuffer::~ByteArrayBuffer (  )  [virtual]

Member Function Documentation

virtual unsigned char* decaf::internal::nio::ByteArrayBuffer::array (  )  [virtual]

Returns the byte array that backs this buffer.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.

Returns:
The array that backs this buffer
Exceptions:
ReadOnlyBufferException if this buffer is backed by an array but is read-only
UnsupportedOperationException if this buffer is not backed by an accessible array

Implements decaf::nio::ByteBuffer.

virtual int decaf::internal::nio::ByteArrayBuffer::arrayOffset (  )  const [virtual]

Returns the offset within this buffer's backing array of the first element of the buffer.If this buffer is backed by an array then buffer position p corresponds to array index p + arrayOffset().Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.

Returns:
The offset within this buffer's array of the first element of the buffer.
Exceptions:
ReadOnlyBufferException if this buffer is backed by an array but is read-only.
UnsupportedOperationException if this buffer is not backed by an accessible array.

Implements decaf::nio::ByteBuffer.

virtual decaf::nio::CharBuffer* decaf::internal::nio::ByteArrayBuffer::asCharBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a char buffer.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 new Char Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual decaf::nio::DoubleBuffer* decaf::internal::nio::ByteArrayBuffer::asDoubleBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a double buffer.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 divided by eight, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns:
the new double Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual decaf::nio::FloatBuffer* decaf::internal::nio::ByteArrayBuffer::asFloatBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a float buffer.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 divided by four, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns:
the new float Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual decaf::nio::IntBuffer* decaf::internal::nio::ByteArrayBuffer::asIntBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a int buffer.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 divided by four, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns:
the new int Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual decaf::nio::LongBuffer* decaf::internal::nio::ByteArrayBuffer::asLongBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a long buffer.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 divided by eight, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns:
the new long Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual ByteArrayBuffer* decaf::internal::nio::ByteArrayBuffer::asReadOnlyBuffer (  )  const [virtual]

Creates a new, read-only byte 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 byte buffer which the caller then owns.

Implements decaf::nio::ByteBuffer.

virtual decaf::nio::ShortBuffer* decaf::internal::nio::ByteArrayBuffer::asShortBuffer (  )  const [inline, virtual]

Creates a view of this byte buffer as a short buffer.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 divided by two, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns:
the new short Buffer, which the caller then owns.

Implements decaf::nio::ByteBuffer.

References NULL.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::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.

Returns:
a reference to this ByteBuffer.
Exceptions:
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer* decaf::internal::nio::ByteArrayBuffer::duplicate (  )  [virtual]

Creates a new byte 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 Byte Buffer which the caller owns.

Implements decaf::nio::ByteBuffer.

virtual unsigned char decaf::internal::nio::ByteArrayBuffer::get ( int  index  )  const [virtual]

Absolute get method.Reads the byte at the given index.

Parameters:
index The index in the Buffer where the byte is to be read.
Returns:
the byte that is located at the given index.
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual unsigned char decaf::internal::nio::ByteArrayBuffer::get (  )  const [virtual]

Relative get method.Reads the byte at this buffer's current position, and then increments the position.

Returns:
The byte at the buffer's current position.
Exceptions:
BufferUnderflowException if the buffer's current position is not smaller than its limit.

Implements decaf::nio::ByteBuffer.

virtual char decaf::internal::nio::ByteArrayBuffer::getChar ( int  index  )  const [inline, virtual]

Reads one byte at the given index and returns it.

Parameters:
index The index in the Buffer where the byte is to be read.
Returns:
the char at the given index in the buffer
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual char decaf::internal::nio::ByteArrayBuffer::getChar (  )  [inline, virtual]

Reads the next byte at this buffer's current position, and then increments the position by one.

Returns:
the next char in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual double decaf::internal::nio::ByteArrayBuffer::getDouble ( int  index  )  const [virtual]

Reads eight bytes at the given index and returns it.

Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the double at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if index is not smaller than the buffer's limit, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual double decaf::internal::nio::ByteArrayBuffer::getDouble (  )  [virtual]

Reads the next eight bytes at this buffer's current position, and then increments the position by that amount.

Returns:
the next double in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual float decaf::internal::nio::ByteArrayBuffer::getFloat ( int  index  )  const [virtual]

Reads four bytes at the given index and returns it.

Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the float at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual float decaf::internal::nio::ByteArrayBuffer::getFloat (  )  [virtual]

Reads the next four bytes at this buffer's current position, and then increments the position by that amount.

Returns:
the next float in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual int decaf::internal::nio::ByteArrayBuffer::getInt ( int  index  )  const [virtual]

Reads four bytes at the given index and returns it.

Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the int at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual int decaf::internal::nio::ByteArrayBuffer::getInt (  )  [virtual]

Reads the next four bytes at this buffer's current position, and then increments the position by that amount.

Returns:
the next int in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual long long decaf::internal::nio::ByteArrayBuffer::getLong ( int  index  )  const [virtual]

Reads eight bytes at the given index and returns it.

Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the long long at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual long long decaf::internal::nio::ByteArrayBuffer::getLong (  )  [virtual]

Reads the next eight bytes at this buffer's current position, and then increments the position by that amount.

Returns:
the next long long in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual short decaf::internal::nio::ByteArrayBuffer::getShort ( int  index  )  const [virtual]

Reads two bytes at the given index and returns it.

Parameters:
index The index in the Buffer where the bytes are to be read.
Returns:
the short at the given index in the buffer.
Exceptions:
IndexOutOfBoundsException if there are not enough bytes remaining to fill the requested Data Type, or index is negative.

Implements decaf::nio::ByteBuffer.

virtual short decaf::internal::nio::ByteArrayBuffer::getShort (  )  [virtual]

Reads the next two bytes at this buffer's current position, and then increments the position by that amount.

Returns:
the next short in the buffer.
Exceptions:
BufferUnderflowException if there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual bool decaf::internal::nio::ByteArrayBuffer::hasArray (  )  const [inline, virtual]

Tells whether or not this buffer is backed by an accessible byte 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.

Returns:
true if, and only if, this buffer is backed by an array and is not read-only.

Implements decaf::nio::ByteBuffer.

virtual bool decaf::internal::nio::ByteArrayBuffer::isReadOnly (  )  const [inline, virtual]

Tells whether or not this buffer is read-only.

Returns:
true if, and only if, this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::put ( int  index,
unsigned char  value 
) [virtual]

Writes the given byte into this buffer at the given index.

Parameters:
index - position in the Buffer to write the data
value - the byte to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::put ( unsigned char  value  )  [virtual]

Writes the given byte into this buffer at the current position, and then increments the position.

Parameters:
value - the byte value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if this buffer's current position is not smaller than its limit.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putChar ( int  index,
char  value 
) [virtual]

Writes one byte containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putChar ( char  value  )  [virtual]

Writes one byte containing the given value, into this buffer at the current position, and then increments the position by one.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putDouble ( int  index,
double  value 
) [virtual]

Writes eight bytes containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putDouble ( double  value  )  [virtual]

Writes eight bytes containing the given value, into this buffer at the current position, and then increments the position by eight.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putFloat ( int  index,
float  value 
) [virtual]

Writes four bytes containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putFloat ( float  value  )  [virtual]

Writes four bytes containing the given value, into this buffer at the current position, and then increments the position by eight.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putInt ( int  index,
int  value 
) [virtual]

Writes four bytes containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putInt ( int  value  )  [virtual]

Writes four bytes containing the given value, into this buffer at the current position, and then increments the position by eight.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferException if this buffer is read-only

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putLong ( int  index,
long long  value 
) [virtual]

Writes eight bytes containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data.
value The value to write.
Returns:
a reference to this buffer.
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putLong ( long long  value  )  [virtual]

Writes eight bytes containing the given value, into this buffer at the current position, and then increments the position by eight.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putShort ( int  index,
short  value 
) [virtual]

Writes two bytes containing the given value, into this buffer at the given index.

Parameters:
index The position in the Buffer to write the data
value The value to write.
Returns:
a reference to this buffer
Exceptions:
IndexOutOfBoundsException if index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual ByteArrayBuffer& decaf::internal::nio::ByteArrayBuffer::putShort ( short  value  )  [virtual]

Writes two bytes containing the given value, into this buffer at the current position, and then increments the position by eight.

Parameters:
value The value to be written.
Returns:
a reference to this buffer.
Exceptions:
BufferOverflowException if there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferException if this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual void decaf::internal::nio::ByteArrayBuffer::setReadOnly ( bool  value  )  [inline, protected, virtual]

Sets this ByteArrayBuffer as Read-Only or not Read-Only.

Parameters:
value Boolean value, true if this buffer is to be read-only, false otherwise.
virtual ByteArrayBuffer* decaf::internal::nio::ByteArrayBuffer::slice (  )  const [virtual]

Creates a new byte buffer 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 ByteBuffer which the caller owns.

Implements decaf::nio::ByteBuffer.


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

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1