Show / Hide Table of Contents

Class WritingPofHandler

An implementation of IPofHandler that writes a POF stream to a Stream using a DataWriter object.

Inheritance
object
WritingPofHandler
Implements
IPofHandler
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.IO.Pof
Assembly: Coherence.dll
Syntax
public class WritingPofHandler : IPofHandler

Constructors

WritingPofHandler(DataWriter)

Construct a WritingPofHandler that will write a POF stream to the passed DataWriter object.

Declaration
public WritingPofHandler(DataWriter writer)
Parameters
Type Name Description
DataWriter writer

The DataWriter to write to.

Properties

IsCompressable

Determine if the value encoding can be compressed by combining type and value information in such a way that type information could be lost.

Declaration
protected virtual bool IsCompressable { get; }
Property Value
Type Description
bool

true if values can be encoded without type information.

IsSkippable

Determine if the value encoding can be skipped.

Declaration
protected virtual bool IsSkippable { get; }
Property Value
Type Description
bool

true if value encoding of default values can be skipped altogether.

Remarks

A value can be skipped if it is a default value and if it does not have an identity and if it is in a sparse data structure.

Writer

Gets the DataWriter object that this WritingPofHandler is writing to.

Declaration
public virtual DataWriter Writer { get; }
Property Value
Type Description
DataWriter

The DataWriter object that this POF handler is writing to.

Methods

BeginArray(int, int)

Report that an array of values has been encountered in the POF stream.

Declaration
public virtual void BeginArray(int position, int elementCount)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elementCount

The exact number of values (elements) in the array.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the array, and the array extent will then be terminated by a call to EndComplexValue().

BeginCollection(int, int)

Report that a collection of values has been encountered in the POF stream.

Declaration
public virtual void BeginCollection(int position, int elements)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elements

The exact number of values (elements) in the collection.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the elements elements in the collection, and the collection extent will then be terminated by a call to EndComplexValue().

BeginMap(int, int)

Report that a map of key/value pairs has been encountered in the POF stream.

Declaration
public virtual void BeginMap(int position, int elements)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elements

The exact number of key/value pairs (entries) in the map.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the elements elements in the map, and the map extent will then be terminated by a call to EndComplexValue().

BeginSparseArray(int, int)

Report that a sparse array of values has been encountered in the POF stream.

Declaration
public virtual void BeginSparseArray(int position, int elementCount)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elementCount

The exact number of elements in the array, which is greater than or equal to the number of values in the sparse POF stream; in other words, the number of values that will subsequently be reported will not exceed this number.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for present element in the sparse array (up to elementCount elements), and the array extent will then be terminated by a call to EndComplexValue().

BeginUniformArray(int, int, int)

Report that a uniform array of values has been encountered in the POF stream.

Declaration
public virtual void BeginUniformArray(int position, int elementCount, int typeId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elementCount

The exact number of values (elements) in the array.

int typeId

The type identifier for all of the values in the uniform array.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the array, and the array extent will then be terminated by a call to EndComplexValue().

BeginUniformCollection(int, int, int)

Report that a uniform collection of values has been encountered in the POF stream.

Declaration
public virtual void BeginUniformCollection(int position, int elementCount, int typeId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elementCount

The exact number of values (elements) in the collection.

int typeId

The type identifier for all of the values in the uniform collection.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the collection, and the collection extent will then be terminated by a call to EndComplexValue().

BeginUniformKeysMap(int, int, int)

Report that a map of key/value pairs (with the keys being of a uniform type) has been encountered in the POF stream.

Declaration
public virtual void BeginUniformKeysMap(int position, int elements, int keysTypeId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elements

The exact number of key/value pairs (entries) in the map.

int keysTypeId

The type identifier for all of the keys in the uniform-keys map.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the elements elements in the map, and the map extent will then be terminated by a call to EndComplexValue().

BeginUniformMap(int, int, int, int)

Report that a map of key/value pairs (with the keys being of a uniform type and the values being of a uniform type) has been encountered in the POF stream.

Declaration
public virtual void BeginUniformMap(int position, int elements, int keysTypeId, int valuesTypeId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elements

The exact number of key/value pairs (entries) in the map.

int keysTypeId

The type identifier for all of the keys in the uniform map.

int valuesTypeId

The type identifier for all of the values in the uniform map.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for each of the elements elements in the map, and the map extent will then be terminated by a call to EndComplexValue().

BeginUniformSparseArray(int, int, int)

Report that a uniform sparse array of values has been encountered in the POF stream.

Declaration
public virtual void BeginUniformSparseArray(int position, int elements, int typeId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int elements

The exact number of elements in the array, which is greater than or equal to the number of values in the sparse POF stream; in other words, the number of values that will subsequently be reported will not exceed this number.

int typeId

The type identifier for all of the values in the uniform sparse array.

Remarks

This method call will be followed by a separate call to an "on" or "begin" method for present element in the sparse array (up to elements elements), and the array extent will then be terminated by a call to EndComplexValue().

BeginUserType(int, int, int, int)

Report that a value of a "user type" has been encountered in the POF stream.

Declaration
public virtual void BeginUserType(int position, int nId, int userTypeId, int versionId)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int nId

Identity of the object to encode, or -1 if identity shouldn't be encoded in the POF stream.

int userTypeId

The user type identifier, (userTypeId >= 0).

int versionId

The version identifier for the user data type data in the POF stream, (versionId >= 0).

Remarks

A user type is analogous to a "class", and a value of a user type is analogous to an "object".

This method call will be followed by a separate call to an "on" or "begin" method for each of the property values in the user type, and the user type will then be terminated by a call to EndComplexValue().

EncodePosition(int)

Called for each and every value going into the POF stream, in case the value needs its position to be encoded into the stream.

Declaration
protected virtual void EncodePosition(int position)
Parameters
Type Name Description
int position

The position (property position, array position, etc.)

EndComplexValue()

Signifies the termination of the current complex value.

Declaration
public virtual void EndComplexValue()
Remarks

Complex values are any of the collection, array, map and user types. For each call to one of the "begin" methods, there will be a corresponding call to this method, even if there were no contents in the complex value.

GetComplex()

Obtain the current Complex object that represents the complex type that is being written to the POF stream.

Declaration
protected virtual WritingPofHandler.Complex GetComplex()
Returns
Type Description
WritingPofHandler.Complex

The current Complex object.

IsTypeIdEncoded(int)

Determine if the type should be encoded for the current value.

Declaration
protected virtual bool IsTypeIdEncoded(int typeId)
Parameters
Type Name Description
int typeId

The type of the current value.

Returns
Type Description
bool

true if the type ID should be placed into the POF stream, and false if only the value itself should be placed into the stream.

OnBoolean(int, bool)

Report that a boolean value has been encountered in the POF stream.

Declaration
public virtual void OnBoolean(int position, bool f)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

bool f

The boolean value.

OnChar(int, char)

Report that a character value has been encountered in the POF stream.

Declaration
public virtual void OnChar(int position, char ch)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

char ch

The character value as a char.

OnCharString(int, string)

Report that a character string value has been encountered in the POF stream.

Declaration
public virtual void OnCharString(int position, string s)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

string s

The character string value as a String object.

OnDate(int, int, int, int)

Report that a date value has been encountered in the POF stream.

Declaration
public virtual void OnDate(int position, int year, int month, int day)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int year

The year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900.

int month

The month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11).

int day

The day number between 1 and 31 inclusive as defined by ISO8601.

OnDateTime(int, int, int, int, int, int, int, int, bool)

Report that a date-time value has been encountered in the POF stream.

Declaration
public virtual void OnDateTime(int position, int year, int month, int day, int hour, int minute, int second, int nano, bool isUTC)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int year

The year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900.

int month

The month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11).

int day

The day number between 1 and 31 inclusive as defined by ISO8601.

int hour

The hour between 0 and 23 inclusive.

int minute

The minute value between 0 and 59 inclusive.

int second

The second value between 0 and 59 inclusive (and theoretically 60 for a leap-second).

int nano

The nanosecond value between 0 and 999999999 inclusive.

bool isUTC

true if the time value is UTC or false if the time value does not have an explicit time zone.

OnDateTime(int, int, int, int, int, int, int, int, TimeSpan)

Report that a date-time value (with a timezone offset) has been encountered in the POF stream.

Declaration
public virtual void OnDateTime(int position, int year, int month, int day, int hour, int minute, int second, int nano, TimeSpan zoneOffset)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int year

The year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900.

int month

The month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11).

int day

The day number between 1 and 31 inclusive as defined by ISO8601.

int hour

The hour between 0 and 23 inclusive.

int minute

The minute value between 0 and 59 inclusive.

int second

The second value between 0 and 59 inclusive (and theoretically 60 for a leap-second).

int nano

The nanosecond value between 0 and 999999999 inclusive.

TimeSpan zoneOffset

The timezone offset from UTC, for example 0 for BST, -5 for EST and +1 for CET.

OnDayTimeInterval(int, int, int, int, int, int)

Report that a day-time interval value has been encountered in the POF stream.

Declaration
public virtual void OnDayTimeInterval(int position, int days, int hours, int minutes, int seconds, int nanos)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int days

The number of days in the day-time interval.

int hours

The number of hours in the day-time interval, from 0 to 23 inclusive.

int minutes

The number of minutes in the day-time interval, from 0 to 59 inclusive.

int seconds

The number of seconds in the day-time interval, from 0 to 59 inclusive.

int nanos

The number of nanoseconds in the day-time interval, from 0 to 999999999 inclusive.

OnDecimal(int, decimal)

Report that a Decimal value has been encountered in the POF stream.

Declaration
protected virtual void OnDecimal(int position, decimal dec)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

decimal dec

The decimal value as a Decimal.

OnDecimal128(int, decimal)

Report that a Decimal128 value has been encountered in the POF stream.

Declaration
public virtual void OnDecimal128(int position, decimal dec)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

decimal dec

The decimal value as a Decimal.

OnDecimal32(int, decimal)

Report that a Decimal32 value has been encountered in the POF stream.

Declaration
public virtual void OnDecimal32(int position, decimal dec)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

decimal dec

The decimal value as a Decimal.

OnDecimal64(int, decimal)

Report that a Decimal64 value has been encountered in the POF stream.

Declaration
public virtual void OnDecimal64(int position, decimal dec)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

decimal dec

The decimal value as a Decimal.

OnFloat32(int, float)

Report that a base-2 single-precision floating point value has been encountered in the POF stream.

Declaration
public virtual void OnFloat32(int position, float fl)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

float fl

The floating point value as a float.

OnFloat64(int, double)

Report that a base-2 double-precision floating point value has been encountered in the POF stream.

Declaration
public virtual void OnFloat64(int position, double dfl)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

double dfl

The floating point value as a double.

OnIdentityReference(int, int)

Specifies that a reference to a previously-identified value has been encountered in the POF stream.

Declaration
public virtual void OnIdentityReference(int position, int id)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

int id

The identity of the previously encountered value, as was specified in a previous call to RegisterIdentity(int).

OnInt128(int, RawInt128)

Report that an Int128 value has been encountered in the POF stream.

Declaration
public virtual void OnInt128(int position, RawInt128 n)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

RawInt128 n

The integer value as an Int128.

OnInt16(int, short)

Report that a short integer value has been encountered in the POF stream.

Declaration
public virtual void OnInt16(int position, short n)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

short n

The integer value as a short.

OnInt32(int, int)

Report that an integer value has been encountered in the POF stream.

Declaration
public virtual void OnInt32(int position, int n)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int n

The integer value as an int.

OnInt64(int, long)

Report that a long integer value has been encountered in the POF stream.

Declaration
public virtual void OnInt64(int position, long n)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

long n

The integer value as a long.

OnNullReference(int)

Specifies that a null value has been encountered in the POF stream.

Declaration
public virtual void OnNullReference(int position)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

OnOctet(int, int)

Report that an octet value (a byte) has been encountered in the POF stream.

Declaration
public virtual void OnOctet(int position, int b)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int b

The octet value as an int whose value is in the range 0 to 255 (0x00-0xFF) inclusive.

OnOctetString(int, Binary)

Report that a octet string value has been encountered in the POF stream.

Declaration
public virtual void OnOctetString(int position, Binary bin)
Parameters
Type Name Description
int position

Context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a dictionary, -1 otherwise.

Binary bin

The octect string value as a Binary object.

OnTime(int, int, int, int, int, bool)

Report that a time value has been encountered in the POF stream.

Declaration
public virtual void OnTime(int position, int hour, int minute, int second, int nanosecond, bool isUTC)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int hour

The hour between 0 and 23 inclusive.

int minute

The minute value between 0 and 59 inclusive.

int second

The second value between 0 and 59 inclusive (and theoretically 60 for a leap-second).

int nanosecond

The nanosecond value between 0 and 999999999 inclusive.

bool isUTC

true if the time value is UTC or false if the time value does not have an explicit time zone.

OnTime(int, int, int, int, int, TimeSpan)

Report that a time value (with a timezone offset) has been encountered in the POF stream.

Declaration
public virtual void OnTime(int position, int hour, int minute, int second, int nano, TimeSpan zoneOffset)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int hour

The hour between 0 and 23 inclusive.

int minute

The minute value between 0 and 59 inclusive.

int second

The second value between 0 and 59 inclusive (and theoretically 60 for a leap-second).

int nano

The nanosecond value between 0 and 999999999 inclusive.

TimeSpan zoneOffset

The timezone offset from UTC, for example 0 for BST, -5 for EST and +1 for CET.

See Also
worldtimezone.com

OnTimeInterval(int, int, int, int, int)

Report that a time interval value has been encountered in the POF stream.

Declaration
public virtual void OnTimeInterval(int position, int hours, int minutes, int seconds, int nanos)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int hours

The number of hours in the time interval.

int minutes

The number of minutes in the time interval, from 0 to 59 inclusive.

int seconds

The number of seconds in the time interval, from 0 to 59 inclusive.

int nanos

The number of nanoseconds, from 0 to 999999999 inclusive.

OnYearMonthInterval(int, int, int)

Report that a year-month interval value has been encountered in the POF stream.

Declaration
public virtual void OnYearMonthInterval(int position, int years, int months)
Parameters
Type Name Description
int position

Context-sensitive position information: property position within a user type, array position within an array, element counter within a collection, entry counter within a map, -1 otherwise.

int years

The number of years in the year-month interval.

int months

The number of months in the year-month interval.

RegisterIdentity(int)

This method is invoked when an identity is encountered in the POF stream.

Declaration
public virtual void RegisterIdentity(int id)
Parameters
Type Name Description
int id

If (nId >= 0), then this is the identity encountered in the POF stream, otherwise it is an indicator that the following value could have been assigned an identifier but was not (i.e. that the subsequent value is of a referenceable data type).

Remarks

The identity is used to uniquely identify the next value in the POF stream, and can be later referenced by the OnIdentityReference(int, int) method.

Implements

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