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

E80355-01

OctetArrayReadBuffer Class Reference

#include <coherence/io/OctetArrayReadBuffer.hpp>

Inherits AbstractOctetArrayReadBuffer.

List of all members.


Detailed Description

A ReadBuffer on top of an octet Array.

Author:
jh 2008.01.03

Public Types

typedef spec::Handle Handle
 OctetArrayReadBuffer Handle definition.
typedef spec::View View
 OctetArrayReadBuffer View definition.
typedef spec::Holder Holder
 OctetArrayReadBuffer Holder definition.

Public Member Functions

virtual TypedHandle
< const String
toString () const
 Output a human-readable description of this Object to the given stream.

Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents and is generally how toString() will be implemented.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::View vs = COH_TO_STRING(vKey << " = " << vValue);

The COH_TO_STRING macro is also the most common way to implement the toString method. For example:

 virtual TypedHandle<const String> Person::toString() const
     {
     return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN);
     }

Returns:
a string representation of this object


Protected Member Functions

 OctetArrayReadBuffer (Array< octet_t >::View vab, size32_t of=0, size32_t cb=npos, bool fCopy=false)
 Construct an OctetArrayReadBuffer object from a portion of an octet Array.
 OctetArrayReadBuffer (const OctetArrayReadBuffer &that)
 Copy constructor.
virtual void updateLength (size32_t cb)
 Allow the length to be modified.
virtual ReadBuffer::View instantiateReadBuffer (size32_t of, size32_t cb) const
 Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer.

Parameters:
of the beginning index, inclusive
cb the number of bytes to include in the resulting ReadBuffer
Returns:
a ReadBuffer that represents a portion of this ReadBuffer


Constructor & Destructor Documentation

OctetArrayReadBuffer ( Array< octet_t >::View  vab,
size32_t  of = 0,
size32_t  cb = npos,
bool  fCopy = false 
) [protected]

Construct an OctetArrayReadBuffer object from a portion of an octet Array.

Parameters:
vab an Array of octets
of the offset into the octet Array
cb the number of octets to extract or npos for (vab->length - of)
fCopy true to make a copy of the passed in Array
Exceptions:
IndexOutOfBoundsException if of + cb is larger than vab->length
NullPointerException if vab is NULL


Member Function Documentation

virtual void updateLength ( size32_t  cb  )  [protected, virtual]

Allow the length to be modified.

This method is provided for use by OctetArrayWriteBuffer only, and only for read buffers that it owns.

Parameters:
cb the new length


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