Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

ReadBuffer Class Reference

#include <coherence/io/ReadBuffer.hpp>

Inherits Object.

Inherited by AbstractReadBuffer [virtual].

List of all members.


Detailed Description

The ReadBuffer interface represents an in-memory block of binary data.
Author:
jh 2007.12.20

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.

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 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...

Member Function Documentation

virtual size32_t length (  )  const [pure virtual]

Determine the length of the buffer.

Returns:
the number of octets of data represented by this ReadBuffer

Implemented in OctetArrayReadBuffer.

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.

Parameters:
of  the offset (index) of the octet
Returns:
the octet at the specified offset in this ReadBuffer
Exceptions:
IndexOutOfBoundsException  if the of argument is not less than the length of this ReadBuffer

Implemented in OctetArrayReadBuffer.

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) - 1
 
This method allows the caller to extract a chunk of octets into the caller's own array.
Parameters:
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
Exceptions:
IndexOutOfBoundsException  if any of the following is true:
  • ofBegin is greater than ofEnd
  • ofEnd is greater than the length of this ReadBuffer;
  • ofDest + (ofEnd - ofBegin) is larger than habDest->length
NullPointerException  if habDest is NULL

Implemented in OctetArrayReadBuffer.

virtual ReadBuffer::View getReadBuffer ( size32_t  of,
size32_t  cb  
) const [pure virtual]

Obtain a ReadBuffer for a portion of this ReadBuffer.

Parameters:
of  the beginning index, inclusive
cb  the number of octets to include in the resulting ReadBuffer
Returns:
a ReadBuffer that represents a portion of this ReadBuffer
Exceptions:
IndexOutOfBoundsException  if of + cb is larger than the length of this ReadBuffer

Implemented in AbstractReadBuffer.

virtual Array<octet_t>::View toOctetArray (  )  const [pure virtual]

Get the contents of the ReadBuffer as an octet array.

This is the equivalent of toOctetArray(0, length()).

Returns:
an octet array with the contents of this ReadBuffer object

Implemented in AbstractReadBuffer.

virtual Array<octet_t>::View toOctetArray ( size32_t  of,
size32_t  cb  
) const [pure virtual]

Get a portion of the contents of the ReadBuffer as an octet array.

Parameters:
of  the beginning index, inclusive
cb  the number of octets to include in the resulting array
Returns:
an octet array containing the specified portion of this ReadBuffer
Exceptions:
IndexOutOfBoundsException  if of + cb is larger than the length of this ReadBuffer

Implemented in AbstractReadBuffer, and OctetArrayReadBuffer.

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).

Returns:
a BufferInput that is reading from this buffer starting at offset zero

Implemented in AbstractReadBuffer.


The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.