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

E47891-01

PofBufferReader Class Reference

#include <coherence/io/pof/PofBufferReader.hpp>

Inherits PofHelper, and PofReader.

Inherited by UserTypeReader.

List of all members.


Detailed Description

PofReader implementation that reads POF-encoded data from a ReadBuffer::BufferInput.

Author:
jh 2008.04.09

Public Types

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

Public Member Functions

virtual bool readBoolean (int32_t iProp)
 Read a boolean property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the bool property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual octet_t readOctet (int32_t iProp)
 Read an octet property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the octet_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual char16_t readChar16 (int32_t iProp)
 Read a 16-bit Unicode character property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the 16-bit Unicode character property value as a char16_t value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual int16_t readInt16 (int32_t iProp)
 Read a 16-bit integer property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int16_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual int32_t readInt32 (int32_t iProp)
 Read a 32-bit integer property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int32_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual int64_t readInt64 (int32_t iProp)
 Read a 64-bit integer property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int64_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual float32_t readFloat32 (int32_t iProp)
 Read a a 32-bit floating-point property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the float32_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual float64_t readFloat64 (int32_t iProp)
 Read a 64-bit floating-point property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the float64_t property value
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array< bool >
::Handle 
readBooleanArray (int32_t iProp)
 Read a boolean array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the bool array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< octet_t >::Handle 
readOctetArray (int32_t iProp)
 Read an octet array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the octet_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< char16_t >::Handle 
readChar16Array (int32_t iProp)
 Read a 16-bit Unicode character array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the char16_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< int16_t >::Handle 
readInt16Array (int32_t iProp)
 Read a 16-bit integer array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int16_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< int32_t >::Handle 
readInt32Array (int32_t iProp)
 Read a 32-bit integer array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int32_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< int64_t >::Handle 
readInt64Array (int32_t iProp)
 Read a 64-bit integer array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the int64_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< float32_t >
::Handle 
readFloat32Array (int32_t iProp)
 Read a a 32-bit floating-point array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the float32_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Array
< float64_t >
::Handle 
readFloat64Array (int32_t iProp)
 Read a a 64-bit floating-point array property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the float64_t array property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Binary::View readBinary (int32_t iProp)
 Read a Binary property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the Binary property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual String::View readString (int32_t iProp)
 Read a String property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the String property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual RawDate::View readRawDate (int32_t iProp)
 Read a RawDate property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawDate property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual RawTime::View readRawTime (int32_t iProp)
 Read a RawTime property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawTime property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual RawDateTime::View readRawDateTime (int32_t iProp)
 Read a RawDateTime property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawDateTime property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual
RawYearMonthInterval::View 
readRawYearMonthInterval (int32_t iProp)
 Read a RawYearMonthInterval property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawYearMonthInterval property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual
RawTimeInterval::View 
readRawTimeInterval (int32_t iProp)
 Read a RawTimeInterval property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawTimeInterval property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual
RawDayTimeInterval::View 
readRawDayTimeInterval (int32_t iProp)
 Read a RawDayTimeInterval property from the POF stream.

Parameters:
iProp the property index to read
Returns:
the RawDayTimeInterval property value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Object::Holder readObject (int32_t iProp)
 Read a property of any type, including a user type, from the POF stream.

Parameters:
iProp the property index to read
Returns:
the Object value, or NULL if no value was available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual
ObjectArray::Handle 
readObjectArray (int32_t iProp, ObjectArray::Handle ha=NULL)
 Read an ObjectArray property from the POF stream.

Parameters:
iProp the property index to read
ha the optional ObjectArray to use to store the values, or to use as a typed template for creating an array to store the values; may be NULL
Returns:
an ObjectArray of object values, or NULL if no ObjectArray is passed and there is no array data in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual LongArray::View readLongArray (int32_t iProp, LongArray::Handle hla=NULL)
 Read a LongArray of object values from the POF stream.

Parameters:
iProp the property index to read
hla the optional LongArray to use to store the values; may be NULL
Returns:
a LongArray of object values, or NULL if no LongArray is passed and there is no key/value data available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Collection::View readCollection (int32_t iProp, Collection::Handle hCol=NULL)
 Read a Collection of object values from the POF stream.

Parameters:
iProp the property index to read
hCol the optional Collection to use to store the values; may be NULL
Returns:
a Collection of object values, or NULL if no Collection is passed and there is no collection data available in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual Map::View readMap (int32_t iProp, Map::Handle hMap=NULL)
 Read a Map of key/value pairs from the POF stream.

Parameters:
iProp the property index to read
hMap the optional Map to initialize; the handle may be NULL
Returns:
a Map of key/value pairs, or NULL if no Map is passed and there is no key/value data in the POF stream
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::io::IOException if an I/O error occurs

virtual PofContext::View getPofContext () const
 Return the PofContext object used by this PofReader to deserialize user types from a POF stream.

Returns:
the PofContext object that contains user type meta-data

virtual void setPofContext (PofContext::View vCtx)
 Configure the PofContext object used by this PofReader to deserialize user types from a POF stream.

Note: this is an advanced method that should be used with care. For example, if this method is being used to switch to another PofContext mid-POF stream, it is important to eventually restore the original PofContext. For example:

 PofContext::View vCtxOrig = hReader->getPofContext();

 // switch to another PofContext
 PofContext::View vCtxNew = ...;
 hReader->setContext(vCtxNew);

 // read POF data using the reader
 ...

 // restore the original PofContext
 hReader->setPofContext(vCtxOrig);
 

Parameters:
vCtx the new PofContext; must not be NULL

virtual int32_t getUserTypeId () const
 Determine the user type that is currently being parsed.

Returns:
the user type information, or -1 if the PofReader is not currently parsing a user type

virtual int32_t getVersionId () const
 Determine the version identifier of the user type that is currently being parsed.

Returns:
the integer version ID read from the POF stream; always non-negative
Exceptions:
coherence::lang::IllegalStateException if no user type is being parsed

virtual void registerIdentity (Object::Holder oh)
 Register an identity for a newly created user type instance.

If identity/reference types are enabled, an identity is used to uniquely identify a user type instance within a POF stream. The identity immediately proceeds the instance value in the POF stream and can be used later in the stream to reference the instance.

PofSerializer implementations must call this method with the user type instance instantiated during deserialization prior to reading any properties of the instance which are user type instances themselves.

Parameters:
oh the object to register the identity for
See also:
PofSerializer::deserialize(PofReaderHandle)
Since:
Coherence 3.7.1

virtual PofReader::Handle createNestedPofReader (int32_t iProp)
 Obtain a PofReader that can be used to read a set of properties from a single property of the current user type.

The returned PofReader is only valid from the time that it is returned until the next call is made to this PofReader.

Parameters:
iProp the property index to read from
Returns:
a PofReader that reads its contents from a single property of this PofReader
Exceptions:
coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
coherence::lang::IllegalStateException if no user type is being parsed
coherence::io::IOException if an I/O error occurs
Since:
Coherence 3.6

virtual Binary::View readRemainder ()
 Read all remaining indexed properties of the current user type from the POF stream.

As part of reading in a user type, this method must be called by the PofSerializer that is reading the user type, or the read position within the POF stream will be corrupted.

Subsequent calls to the various readXYZ methods of this interface will fail after this method is called.

Returns:
a buffer containing zero or more indexed properties in binary POF encoded form
Exceptions:
coherence::lang::IllegalStateException if no user type is being parsed
coherence::io::IOException if an I/O error occurs


Protected Member Functions

 PofBufferReader (ReadBuffer::BufferInput::Handle hIn, PofContext::View vCtx)
 Construct a new PofBufferReader that will read a POF stream from the passed BufferInput object.
virtual bool advanceTo (int32_t iProp)
 Advance through the POF stream until the specified property is found.
virtual void complete (int32_t iProp)
 Register the completion of the parsing of a value.
virtual
PofBufferReader::Handle 
getParentParser ()
 If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.
virtual
PofBufferReader::View 
getParentParser () const
 If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.
virtual LongArray::Handle ensureReferenceRegistry ()
 Obtain the registry for identity-reference pairs, creating it if necessary.
virtual void registerIdentity (int32_t nId, Object::Holder ohValue)
 Register the passed value with the passed identity.
virtual Object::Holder lookupIdentity (int32_t nId)
 Look up the specified identity and return the object to which it refers.
virtual Object::Holder readAsObject (int32_t nType)
 Read a POF value as an Object.
virtual Object::Holder readAsUniformObject (int32_t nType)
 Read a POF value in a uniform array/map as an Object.
virtual
ObjectArray::Handle 
readAsObjectArray (int32_t nType, ObjectArray::Handle ha=NULL)
 Read a POF value as an Object array.

Protected Attributes

FinalHandle
< ReadBuffer::BufferInput
f_hIn
 The BufferInput containing the POF stream.
FinalView< PofContextf_vCtx
 The PofContext to use to realize user data types as objects.
FinalHandle< LongArrayf_hlaRefs
 Lazily-constructed mapping of identities to references.

Constructor & Destructor Documentation

PofBufferReader ( ReadBuffer::BufferInput::Handle  hIn,
PofContext::View  vCtx 
) [protected]

Construct a new PofBufferReader that will read a POF stream from the passed BufferInput object.

Parameters:
hIn a BufferInput object
vCtx the PofContext
Returns:
the new PofBufferReader


Member Function Documentation

virtual bool advanceTo ( int32_t  iProp  )  [protected, virtual]

Advance through the POF stream until the specified property is found.

If the property is found, return true, otherwise return false and advance to the first property that follows the specified property.

Parameters:
iProp the index of the property to advance to
Returns:
true if the property is found
Exceptions:
IllegalStateException if the POF stream has already advanced past the desired property
IOException if an I/O error occurs

Reimplemented in UserTypeReader.

virtual void complete ( int32_t  iProp  )  [protected, virtual]

Register the completion of the parsing of a value.

Parameters:
iProp the property index
Exceptions:
IOException if an I/O error occurs

Reimplemented in UserTypeReader.

virtual PofBufferReader::Handle getParentParser (  )  [protected, virtual]

If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.

Returns:
the parser for the context within which this parser is operating

Reimplemented in UserTypeReader.

virtual PofBufferReader::View getParentParser (  )  const [protected, virtual]

If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.

Returns:
the parser for the context within which this parser is operating

Reimplemented in UserTypeReader.

virtual LongArray::Handle ensureReferenceRegistry (  )  [protected, virtual]

Obtain the registry for identity-reference pairs, creating it if necessary.

Returns:
the identity-reference registry, never NULL

virtual void registerIdentity ( int32_t  nId,
Object::Holder  ohValue 
) [protected, virtual]

Register the passed value with the passed identity.

Parameters:
nId the identity
ohValue the value to register
Exceptions:
IOException if the specified identity is already registered with a different object

virtual Object::Holder lookupIdentity ( int32_t  nId  )  [protected, virtual]

Look up the specified identity and return the object to which it refers.

Parameters:
nId the identity
Returns:
the object registered under that identity
Exceptions:
IOException if the requested identity is not registered

virtual Object::Holder readAsObject ( int32_t  nType  )  [protected, virtual]

Read a POF value as an Object.

Parameters:
nType the type identifier of the value
Returns:
an Object value
Exceptions:
IOException if an I/O error occurs

virtual Object::Holder readAsUniformObject ( int32_t  nType  )  [protected, virtual]

Read a POF value in a uniform array/map as an Object.

Parameters:
nType the type identifier of the value
Returns:
an Object value
Exceptions:
IOException if an I/O error occurs
Since:
Coherence 3.7.1

virtual ObjectArray::Handle readAsObjectArray ( int32_t  nType,
ObjectArray::Handle  ha = NULL 
) [protected, virtual]

Read a POF value as an Object array.

Parameters:
nType the type identifier of the value
ha the optional ObjectArray to use to store the values, or to use as a typed template for creating an array to store the values
Returns:
an Object array
Exceptions:
IOException if an I/O error occurs


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