#include <coherence/io/ReadBuffer.hpp>
Inherits Object.
Inherited by AbstractReadBuffer [virtual]
.
Public Types | |
typedef spec::Handle | Handle |
ReadBuffer Handle definition. | |
typedef spec::View | View |
ReadBuffer View definition. | |
typedef spec::Holder | Holder |
ReadBuffer Holder definition. | |
typedef this_spec::Handle | Handle |
Object Handle definition. | |
typedef this_spec::View | View |
Object View definition. | |
typedef this_spec::Holder | Holder |
Object Holder definition. | |
typedef TypedHandle < const coherence::util::Binary > | BinaryView |
Binary View definition. | |
Public Member Functions | |
virtual size32_t | length () const =0 |
Determine the length of the buffer. | |
virtual octet_t | read (size32_t of) const =0 |
Returns the octet at the specified offset. | |
virtual void | read (size32_t ofBegin, size32_t ofEnd, Array< octet_t >::Handle habDest, size32_t ofDest) const =0 |
Copies octets from this ReadBuffer into the destination octet array. | |
virtual ReadBuffer::View | getReadBuffer (size32_t of, size32_t cb) const =0 |
Obtain a ReadBuffer for a portion of this ReadBuffer. | |
virtual BinaryView | toBinary () const =0 |
Returns a new Binary object that holds the complete contents of this ReadBuffer. | |
virtual BinaryView | toBinary (size32_t of, size32_t cb) const =0 |
Returns a Binary object that holds the specified portion of this ReadBuffer. | |
virtual Array < octet_t >::View | toOctetArray () const =0 |
Get the contents of the ReadBuffer as an octet array. | |
virtual Array < octet_t >::View | toOctetArray (size32_t of, size32_t cb) const =0 |
Get a portion of the contents of the ReadBuffer as an octet array. | |
virtual BufferInput::Handle | getBufferInput () const =0 |
Get a BufferInput object to read data from this buffer. | |
Classes | |
class | BufferInput |
The BufferInput interface represents a data input stream on top of a ReadBuffer. More... |
virtual size32_t length | ( | ) | const [pure virtual] |
Determine the length of the buffer.
Implemented in AbstractOctetArrayReadBuffer.
virtual octet_t read | ( | size32_t | of | ) | const [pure virtual] |
Returns the octet at the specified offset.
An offset ranges from 0
to length() - 1
. The first octet of the sequence is at offset 0
, the next at offset 1
, and so on, as for array indexing.
of | the offset (index) of the octet |
IndexOutOfBoundsException | if the of argument is not less than the length of this ReadBuffer |
Implemented in AbstractOctetArrayReadBuffer.
virtual void read | ( | size32_t | ofBegin, | |
size32_t | ofEnd, | |||
Array< octet_t >::Handle | habDest, | |||
size32_t | ofDest | |||
) | const [pure virtual] |
Copies octets from this ReadBuffer into the destination octet array.
The first octet to be copied is at offset ofBegin
; the last octet to be copied is at offset ofEnd-1
(thus the total number of octets to be copied is ofEnd - ofBegin
). The octets are copied into the subarray of habDest
starting at offset ofDest
and ending at index:
ofDest + (ofEnd - ofBegin) - 1This method allows the caller to extract a chunk of octets into the caller's own array.
ofBegin | offset of the first octet in the ReadBuffer to copy | |
ofEnd | offset after the last octet in the ReadBuffer to copy | |
habDest | the destination octet array | |
ofDest | the offset in the destination octet array to copy the first octet to |
IndexOutOfBoundsException | if any of the following is true:
| |
NullPointerException | if habDest is NULL |
Implemented in AbstractOctetArrayReadBuffer.
virtual ReadBuffer::View getReadBuffer | ( | size32_t | of, | |
size32_t | cb | |||
) | const [pure virtual] |
Obtain a ReadBuffer for a portion of this ReadBuffer.
of | the beginning index, inclusive | |
cb | the number of octets to include in the resulting ReadBuffer |
IndexOutOfBoundsException | if of + cb is larger than the length of this ReadBuffer |
Implemented in AbstractReadBuffer.
virtual BinaryView toBinary | ( | ) | const [pure virtual] |
Returns a new Binary object that holds the complete contents of this ReadBuffer.
This is the equivalent of toBinary(0, length())
.
Implemented in AbstractOctetArrayReadBuffer, and AbstractReadBuffer.
virtual BinaryView toBinary | ( | size32_t | of, | |
size32_t | cb | |||
) | const [pure virtual] |
Returns a Binary object that holds the specified portion of this ReadBuffer.
This is the equivalent of getReadBuffer(of, cb)->toBinary()
.
of | the beginning index, inclusive | |
cb | the number of octets to include in the Binary object |
IndexOutOfBoundsException | if of + cb is larger than the length of this ReadBuffer object |
Implemented in AbstractOctetArrayReadBuffer, and AbstractReadBuffer.
Get the contents of the ReadBuffer as an octet array.
This is the equivalent of toOctetArray(0, length())
.
Implemented in AbstractReadBuffer.
Get a portion of the contents of the ReadBuffer as an octet array.
of | the beginning index, inclusive | |
cb | the number of octets to include in the resulting array |
IndexOutOfBoundsException | if of + cb is larger than the length of this ReadBuffer |
Implemented in AbstractOctetArrayReadBuffer, and AbstractReadBuffer.
virtual BufferInput::Handle getBufferInput | ( | ) | const [pure virtual] |
Get a BufferInput object to read data from this buffer.
Note that each call to this method will return a new BufferInput object, with the possible exception being that a zero-length ReadBuffer could always return the same instance (since there is nothing to read).
Implemented in AbstractReadBuffer.