Show / Hide Table of Contents

Interface IPofReader

The IPofReader interface provides the capability of reading a set of non-primitive .NET types ("user types") from a POF stream as an ordered sequence of indexed properties.

Namespace: Tangosol.IO.Pof
Assembly: Coherence.dll
Syntax
public interface IPofReader
Remarks

See IPofWriter for a complete description of the POF user type serialization format.

Properties

PofContext

Gets or sets the IPofContext object used by this IPofReader to deserialize user types from a POF stream.

Declaration
IPofContext PofContext { get; set; }
Property Value
Type Description
IPofContext

The IPofContext object that contains user type meta-data.

Remarks

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

IPofContext ctxOrig = reader.PofContext;
try
{
    // switch to another IPofContext
    reader.PofContext = ...;

    // read POF data using the reader
}
finally
{
    // restore the original PofContext
    reader.PofContext = ctxOrig;
}

UserTypeId

Gets the user type that is currently being parsed.

Declaration
int UserTypeId { get; }
Property Value
Type Description
int

The user type information, or -1 if the IPofReader is not currently parsing a user type.

VersionId

Gets the version identifier of the user type that is currently being parsed.

Declaration
int VersionId { get; }
Property Value
Type Description
int

The integer version ID read from the POF stream; always non-negative.

Exceptions
Type Condition
InvalidOperationException

If no user type is being parsed.

Methods

CreateNestedPofReader(int)

Obtain an IPofReader that can be used to read a set of properties from a single property of the current user type. The returned IPofReader is only valid from the time that it is returned until the next call is made to this IPofReader.

Declaration
IPofReader CreateNestedPofReader(int iProp)
Parameters
Type Name Description
int iProp

The property index to read from.

Returns
Type Description
IPofReader

An IPofReader that reads its contents from a single property of this IPofReader.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property, or if no user type is being parsed.

IOException

if an I/O error occurs

ReadArray(int)

Read an array of object values.

Declaration
Array ReadArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
Array

An array of object values, or null if there is no array data in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadArray(int, Array)

Read an array of object values.

Declaration
Array ReadArray(int index, Array array)
Parameters
Type Name Description
int index

The property index to read.

Array array

The optional array to use to store the values, or to use as a typed template for creating an array to store the values, following the documentation for ArrayList.ToArray(Type).

Returns
Type Description
Array

An array of object values, or null if no array is passed and there is no array data in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadBinary(int)

Read a Binary from the POF stream.

Declaration
Binary ReadBinary(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
Binary

The Binary property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadBoolean(int)

Read a Boolean property from the POF stream.

Declaration
bool ReadBoolean(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
bool

The Boolean property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadBooleanArray(int)

Read a Boolean[] property from the POF stream.

Declaration
bool[] ReadBooleanArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
bool[]

The Boolean[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadByte(int)

Read a Byte property from the POF stream.

Declaration
byte ReadByte(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
byte

The Byte property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadByteArray(int)

Read a Byte[] property from the POF stream.

Declaration
byte[] ReadByteArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
byte[]

The Byte[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadChar(int)

Read a Char property from the POF stream.

Declaration
char ReadChar(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
char

The Char property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadCharArray(int)

Read a Char[] property from the POF stream.

Declaration
char[] ReadCharArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
char[]

The Char[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadCollection(int, ICollection)

Read an ICollection of object values from the POF stream.

Declaration
ICollection ReadCollection(int index, ICollection coll)
Parameters
Type Name Description
int index

The property index to read.

ICollection coll

The optional ICollection to use to store the values.

Returns
Type Description
ICollection

A collection of object values, or null if no collection is passed and there is no collection data in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadCollection<T>(int, ICollection<T>)

Read a generic ICollection<T> of object values from the POF stream.

Declaration
ICollection<T> ReadCollection<T>(int index, ICollection<T> coll)
Parameters
Type Name Description
int index

The property index to read.

ICollection<T> coll

The optional ICollection<T> to use to store the values.

Returns
Type Description
ICollection<T>

A generic collection of object values, or null if no collection is passed and there is no collection data in the POF stream.

Type Parameters
Name Description
T

The type of the elements it the collection.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDate(int)

Read a DateTime property from the POF stream.

Declaration
DateTime ReadDate(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
DateTime

The DateTime property value.

Remarks

This method will read only the date component of a date-time value from the POF stream. It will ignore the time component if present and initialize the time-related fields of the return value to their default values.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDateTime(int)

Read a DateTime property from the POF stream.

Declaration
DateTime ReadDateTime(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
DateTime

The DateTime property value.

Remarks

This method will attempt to read both the date and time component from the POF stream. If the value in the stream does not contain both components, the corresponding values in the returned DateTime instance will be set to default values.

If the encoded value in the POF stream contains time zone information, this method will ignore time zone information and return a literal DateTime value, as read from the stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDayTimeInterval(int)

Reads a TimeSpan from the POF stream.

Declaration
TimeSpan ReadDayTimeInterval(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
TimeSpan

The TimeSpan property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDecimal(int)

Read a Decimal from the POF stream.

Declaration
decimal ReadDecimal(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
decimal

The Decimal property value, or zero if no value was available in the POF stream

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDictionary(int, IDictionary)

Read an IDictionary of key/value pairs from the POF stream.

Declaration
IDictionary ReadDictionary(int index, IDictionary dict)
Parameters
Type Name Description
int index

The property index to read.

IDictionary dict

The optional IDictionary to initialize.

Returns
Type Description
IDictionary

An IDictionary of key/value pairs object values, or null if no dictionary is passed and there is no key/value data in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

ArgumentNullException

If dict is null.

IOException

If an I/O error occurs.

ReadDictionary<TKey, TValue>(int, IDictionary<TKey, TValue>)

Read a generic IDictionary<TKey, TValue> of key/value pairs from the POF stream.

Declaration
IDictionary<TKey, TValue> ReadDictionary<TKey, TValue>(int index, IDictionary<TKey, TValue> dictionary)
Parameters
Type Name Description
int index

The property index to read.

IDictionary<TKey, TValue> dictionary

The optional IDictionary<TKey, TValue> to initialize.

Returns
Type Description
IDictionary<TKey, TValue>

An IDictionary<TKey, TValue> of key/value pairs object values, or null if no dictionary is passed and there is no key/value data in the POF stream.

Type Parameters
Name Description
TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

ArgumentNullException

If dictionary is null.

IOException

If an I/O error occurs.

ReadDouble(int)

Read a Double property from the POF stream.

Declaration
double ReadDouble(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
double

The Double property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadDoubleArray(int)

Read a Double[] property from the POF stream.

Declaration
double[] ReadDoubleArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
double[]

The Double[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt16(int)

Read an Int16 property from the POF stream.

Declaration
short ReadInt16(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
short

The Int16 property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt16Array(int)

Read an Int16[] property from the POF stream.

Declaration
short[] ReadInt16Array(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
short[]

The Int16[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt32(int)

Read an Int32 property from the POF stream.

Declaration
int ReadInt32(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
int

The Int32 property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt32Array(int)

Read an Int32[] property from the POF stream.

Declaration
int[] ReadInt32Array(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
int[]

The Int32[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt64(int)

Read an Int64 property from the POF stream.

Declaration
long ReadInt64(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
long

The Int64 property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadInt64Array(int)

Read an Int64[] property from the POF stream.

Declaration
long[] ReadInt64Array(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
long[]

The Int64[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadLocalDateTime(int)

Read a DateTime property from the POF stream.

Declaration
DateTime ReadLocalDateTime(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
DateTime

The DateTime property value.

Remarks

This method will attempt to read both the date and time component from the POF stream. If the value in the stream does not contain both components, the corresponding values in the returned DateTime instance will be set to default values.

If the encoded value in the POF stream contains time zone information, this method will use it to determine and return the local time for the reading thread.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadLongArray(int, ILongArray)

Read an ILongArray of object values.

Declaration
ILongArray ReadLongArray(int index, ILongArray array)
Parameters
Type Name Description
int index

The property index to read.

ILongArray array

The optional ILongArray object to use to store the values.

Returns
Type Description
ILongArray

An ILongArray of object values, or null if no ILongArray is passed and there is no array data in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadObject(int)

Read a property of any type, including a user type, from the POF stream.

Declaration
object ReadObject(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
object

The object value; may be null.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadRawDateTime(int)

Read a RawDateTime from the POF stream.

Declaration
RawDateTime ReadRawDateTime(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
RawDateTime

The RawDateTime property value, or null if no value was available in the POF stream.

Remarks

The RawDateTime class contains the raw date and time information that was carried in the POF stream, including raw timezone information.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadRawInt128(int)

Read an RawInt128 property from the POF stream.

Declaration
RawInt128 ReadRawInt128(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
RawInt128

The RawInt128 property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadRawTime(int)

Read a RawTime property from the POF stream.

Declaration
RawTime ReadRawTime(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
RawTime

The RawTime property value, or null if no value was available in the POF stream.

Remarks

The RawTime class contains the raw time information that was carried in the POF stream, including raw timezone information.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadRawYearMonthInterval(int)

Read a RawYearMonthInterval from the POF stream.

Declaration
RawYearMonthInterval ReadRawYearMonthInterval(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
RawYearMonthInterval

The RawYearMonthInterval property value, or null if no value was available in the POF stream.

Remarks

The RawYearMonthInterval struct contains the raw year-month interval information that was carried in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadRemainder()

Read all remaining indexed properties of the current user type from the POF stream.

Declaration
Binary ReadRemainder()
Returns
Type Description
Binary

A Binary object containing zero or more indexed properties in binary POF encoded form, or null if no value was available in the POF stream

Remarks

As part of reading in a user type, this method must be called by the IPofSerializer 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.

Exceptions
Type Condition
InvalidOperationException

If no user type is being parsed.

IOException

If an I/O error occurs.

ReadSingle(int)

Read a Single property from the POF stream.

Declaration
float ReadSingle(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
float

The Single property value, or zero if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadSingleArray(int)

Read a Single[] property from the POF stream.

Declaration
float[] ReadSingleArray(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
float[]

The Single[] property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadString(int)

Read a String property from the POF stream.

Declaration
string ReadString(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
string

The String property value, or null if no value was available in the POF stream.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadTimeInterval(int)

Reads a TimeSpan from the POF stream.

Declaration
TimeSpan ReadTimeInterval(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
TimeSpan

The TimeSpan property value, or null if no value was available in the POF stream.

Remarks

This method will read only the time component of a day-time-interval value from the POF stream. It will ignore the day component if present and initialize day-related fields of the return value to their default values.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

ReadUniversalDateTime(int)

Read a DateTime property from the POF stream.

Declaration
DateTime ReadUniversalDateTime(int index)
Parameters
Type Name Description
int index

The property index to read.

Returns
Type Description
DateTime

The DateTime property value.

Remarks

This method will attempt to read both the date and time components from the POF stream. If the value in the stream does not contain both components, the corresponding values in the returned DateTime instance will be set to default values.

If the encoded value in the POF stream contains time zone information, this method will use it to determine and return a Coordinated Universal Time (UTC) value.

Exceptions
Type Condition
InvalidOperationException

If the POF stream has already advanced past the desired property.

IOException

If an I/O error occurs.

RegisterIdentity(object)

Register an identity for a newly created user type instance.

Declaration
void RegisterIdentity(object o)
Parameters
Type Name Description
object o

The object to register the identity for.

Remarks

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.

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

See Also

IPofContext
IPofWriter
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.