activemq-cpp-3.6.0
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:

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
ReadOnlyBufferExceptionif this buffer is backed by an array but is read-only
UnsupportedOperationExceptionif 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
ReadOnlyBufferExceptionif this buffer is backed by an array but is read-only.
UnsupportedOperationExceptionif 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
ReadOnlyBufferExceptionif 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
BufferUnderflowExceptionif 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
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 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the byte is to be read.
Returns
the char at the given index in the buffer
Exceptions
IndexOutOfBoundsExceptionif 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the double at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the float 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 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the long long 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 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the int 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 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the short 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 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
BufferOverflowExceptionif this buffer's current position is not smaller than its limit.
ReadOnlyBufferExceptionif 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
IndexOutOfBoundsExceptionif index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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.

- Public Member Functions inherited from decaf::nio::ByteBuffer
virtual ~ByteBuffer ()
virtual std::string toString () const
ByteBufferget (std::vector< unsigned char > buffer)
 Relative bulk get method.
ByteBufferget (unsigned char *buffer, int size, int offset, int length)
 Relative bulk get method.
ByteBufferput (ByteBuffer &src)
 This method transfers the bytes remaining in the given source buffer into this buffer.
ByteBufferput (const unsigned char *buffer, int size, int offset, int length)
 This method transfers bytes into this buffer from the given source array.
ByteBufferput (std::vector< unsigned char > &buffer)
 This method transfers the entire content of the given source byte array into this buffer.
virtual int compareTo (const ByteBuffer &value) const
 
virtual bool equals (const ByteBuffer &value) const
 
virtual bool operator== (const ByteBuffer &value) const
 
virtual bool operator< (const ByteBuffer &value) const
 
- Public Member Functions inherited from decaf::nio::Buffer
 Buffer (int capactiy)
 Buffer (const Buffer &other)
virtual ~Buffer ()
virtual int capacity () const
virtual int position () const
virtual Bufferposition (int newPosition)
 Sets this buffer's position.
virtual int limit () const
virtual Bufferlimit (int newLimit)
 Sets this buffer's limit.
virtual Buffermark ()
 Sets this buffer's mark at its position.
virtual Bufferreset ()
 Resets this buffer's position to the previously-marked position.
virtual Bufferclear ()
 Clears this buffer.
virtual Bufferflip ()
 Flips this buffer.
virtual Bufferrewind ()
 Rewinds this buffer.
virtual int remaining () const
 Returns the number of elements between the current position and the limit.
virtual bool hasRemaining () const
 Tells whether there are any elements between the current position and the limit.
- Public Member Functions inherited from decaf::lang::Comparable< ByteBuffer >
virtual ~Comparable ()
virtual int compareTo (const ByteBuffer &value) const =0
 Compares this object with the specified object for order.
virtual bool equals (const ByteBuffer &value) const =0
virtual bool operator== (const ByteBuffer &value) const =0
 Compares equality between this object and the one passed.
virtual bool operator< (const ByteBuffer &value) const =0
 Compares this object to another and returns true if this object is considered to be less than the one passed.

Protected Member Functions

virtual void setReadOnly (bool value)
 Sets this ByteArrayBuffer as Read-Only or not Read-Only.
- Protected Member Functions inherited from decaf::nio::ByteBuffer
 ByteBuffer (int capacity)
 Creates a ByteBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.

Additional Inherited Members

- Static Public Member Functions inherited from decaf::nio::ByteBuffer
static ByteBufferallocate (int capacity)
 Allocates a new byte buffer whose position will be zero its limit will be its capacity and its mark is not set.
static ByteBufferwrap (unsigned char *array, int size, int offset, int length)
 Wraps the passed buffer with a new ByteBuffer.
static ByteBufferwrap (std::vector< unsigned char > &buffer)
 Wraps the passed STL Byte Vector in a ByteBuffer.
- Protected Attributes inherited from decaf::nio::Buffer
int _position
int _capacity
int _limit
int _mark
bool _markSet

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
capacityThe size of the array, this is the limit we read and write to.
readOnlyShould this buffer be read-only, default as false
Exceptions
IllegalArguementExceptionif 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
arrayThe array to wrap.
sizeThe size of the array passed.
offsetThe position that is this buffers start position.
lengthThe size of the sub-array, this is the limit we read and write to.
readOnlyShould this buffer be read-only, default as false.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif 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
arrayThe ByteArrayAdapter to wrap
offsetThe offset into array where the buffer starts
lengthThe length of the array we are wrapping or limit.
readOnlyBoolean indicating if this a readOnly buffer.
Exceptions
NullPointerExceptionif array is NULL
IndexOutOfBoundsExceptionif 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
otherThe 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
ReadOnlyBufferExceptionif this buffer is backed by an array but is read-only
UnsupportedOperationExceptionif 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
ReadOnlyBufferExceptionif this buffer is backed by an array but is read-only.
UnsupportedOperationExceptionif this buffer is not backed by an accessible array.

Implements decaf::nio::ByteBuffer.

virtual decaf::nio::CharBuffer* decaf::internal::nio::ByteArrayBuffer::asCharBuffer ( ) const
inlinevirtual

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
inlinevirtual

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
inlinevirtual

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
inlinevirtual

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
inlinevirtual

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
inlinevirtual

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
ReadOnlyBufferExceptionif 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 ( ) 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
BufferUnderflowExceptionif the buffer's current position is not smaller than its limit.

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
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 index is negative.

Implements decaf::nio::ByteBuffer.

virtual char decaf::internal::nio::ByteArrayBuffer::getChar ( )
inlinevirtual

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
BufferUnderflowExceptionif there are no more bytes remaining in this buffer, meaning we have reached the set limit.

Implements decaf::nio::ByteBuffer.

virtual char decaf::internal::nio::ByteArrayBuffer::getChar ( int  index) const
inlinevirtual

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 char at the given index in the buffer
Exceptions
IndexOutOfBoundsExceptionif 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the double at the given index in the buffer.
Exceptions
IndexOutOfBoundsExceptionif index is not smaller than the buffer's limit, 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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the float 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.

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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the int 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.

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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the long long 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.

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
BufferUnderflowExceptionif 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
indexThe index in the Buffer where the bytes are to be read.
Returns
the short 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.

Implements decaf::nio::ByteBuffer.

virtual bool decaf::internal::nio::ByteArrayBuffer::hasArray ( ) const
inlinevirtual

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
inlinevirtual

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 ( 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
BufferOverflowExceptionif this buffer's current position is not smaller than its limit.
ReadOnlyBufferExceptionif 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
IndexOutOfBoundsExceptionif index greater than the buffer's limit minus the size of the type being written, or index is negative.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif 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
valueThe value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif there are fewer than bytes remaining in this buffer than the size of the data to be written.
ReadOnlyBufferExceptionif 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
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.
ReadOnlyBufferExceptionif this buffer is read-only.

Implements decaf::nio::ByteBuffer.

virtual void decaf::internal::nio::ByteArrayBuffer::setReadOnly ( bool  value)
inlineprotectedvirtual

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

Parameters
valueBoolean 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: