Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

AbstractOctetArrayReadBuffer Class Reference

#include <coherence/io/AbstractOctetArrayReadBuffer.hpp>

Inherits AbstractReadBuffer.

Inherited by OctetArrayReadBuffer, and Binary.

List of all members.


Detailed Description

The AbstractOctetArrayReadBuffer abstract class is intended to serve as a base class for the following:.

  1. the pre-existing Binary class
  2. a new byte[] based class that does not attempt to add the immutability aspect provided by the Binary class

This implementation is not intended to be thread safe.

Author:
phf 2011.03.15
Since:
Coherence 3.7.1

Public Types

typedef spec::Handle Handle
 AbstractOctetArrayReadBuffer Handle definition.
typedef spec::View View
 AbstractOctetArrayReadBuffer View definition.
typedef spec::Holder Holder
 AbstractOctetArrayReadBuffer Holder definition.
typedef this_spec::Handle Handle
 AbstractReadBuffer Handle definition.
typedef this_spec::View View
 AbstractReadBuffer View definition.
typedef this_spec::Holder Holder
 AbstractReadBuffer Holder definition.
typedef TypedHandle
< const
coherence::util::Binary
BinaryView
 Binary View definition.

Public Member Functions

virtual size32_t length () const
 Determine the length of the buffer.

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

virtual octet_t read (size32_t of) const
 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

virtual void read (size32_t ofBegin, size32_t ofEnd, Array< octet_t >::Handle habDest, size32_t ofDest) const
 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

virtual BinaryView toBinary () const
 Returns a new Binary object that holds the complete contents of this ReadBuffer.

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

Returns:
the contents of this ReadBuffer as a Binary object
Since:
Coherence 3.7.1

virtual BinaryView toBinary (size32_t of, size32_t cb) const
 Returns a Binary object that holds the specified portion of this ReadBuffer.

This is the equivalent of getReadBuffer(of, cb)->toBinary().

Parameters:
of the beginning index, inclusive
cb the number of octets to include in the Binary object
Returns:
a Binary object containing the specified portion of this ReadBuffer
Exceptions:
IndexOutOfBoundsException if of + cb is larger than the length of this ReadBuffer object
Since:
Coherence 3.7.1

virtual Array
< octet_t >::View 
toOctetArray (size32_t of, size32_t cb) const
 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

virtual bool equals (Object::View v) const
 

Static Public Attributes

static const size32_t npos
 The largest possible value of type size32_t.

Protected Member Functions

 AbstractOctetArrayReadBuffer ()
 Default constructor; intended for deserialization use by subclasses.
 AbstractOctetArrayReadBuffer (Array< octet_t >::View vab, size32_t of=0, size32_t cb=npos)
 Construct an AbstractOctetArrayReadBuffer on a portion of an octet Array.
virtual
BufferInput::Handle 
instantiateBufferInput () const
 Factory method: Instantiate a BufferInput object to read data from the ReadBuffer.

Returns:
a new BufferInput reading from this ReadBuffer

virtual void resetRange (size32_t of, size32_t cb)
 Reset the portion of the octet array the ReadBuffer operates upon.

Protected Attributes

FinalView< Array
< octet_t > > 
f_vab
 The octet array that holds the binary data.
size32_t m_of
 Offset into the octet array at which the binary data is located.
size32_t m_cb
 Number of octets in the octet array that belong to this ReadBuffer object.

Classes

class  OctetArrayBufferInput
 This is an implementation of the BufferInput interface on top of an octet array. More...

Constructor & Destructor Documentation

AbstractOctetArrayReadBuffer (  )  [protected]

Default constructor; intended for deserialization use by subclasses.

Note that this default constructor leaves the buffer in an invalid state.

AbstractOctetArrayReadBuffer ( Array< octet_t >::View  vab,
size32_t  of = 0,
size32_t  cb = npos 
) [protected]

Construct an AbstractOctetArrayReadBuffer on a portion of an octet Array.

Parameters:
vab an Array of octets
of an offset into the octet array
cb the number of octets to utilize or npos for (vab->length - of)
Exceptions:
IndexOutOfBoundsException if of + cb is larger than vab->length
NullPointerException if vab is NULL


Member Function Documentation

virtual void resetRange ( size32_t  of,
size32_t  cb 
) [protected, virtual]

Reset the portion of the octet array the ReadBuffer operates upon.

Parameters:
of an offset into the octet array
cb the number of octets to utilize
Exceptions:
IndexOutOfBoundsException if of + cb is larger than the buffer's length


Member Data Documentation

FinalView<Array<octet_t> > f_vab [protected]

The octet array that holds the binary data.

This value should not be changed.

size32_t m_of [protected]

Offset into the octet array at which the binary data is located.

This value should not be changed.

size32_t m_cb [protected]

Number of octets in the octet array that belong to this ReadBuffer object.

This value should not be changed.


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