Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
12c (12.1.3.0.0)
E47892-01
The IPofWriter interface provides the capability of writing a set of non-primitive .NET types ("user types") to a POF stream as an ordered sequence of indexed properties.

Namespace: Tangosol.IO.Pof
Assembly: Coherence (in Coherence.dll) Version: 12.1.3.0 (12.1.3.0)

Syntax

C#
public interface IPofWriter

Remarks

The serialized format of a POF user type is as follows:

  • Type Identifier
  • Version Identifier
  • [Property Index, Property Value]*
  • -1

The type identifier is an integer value greater than or equal to zero that identifies the non-primitive .NET type. The type identifier has no explicit or self-describing meaning within the POF stream itself; in other words, the type identifier does not contain the actual class definition. Instead, the IPofWriter and corresponding IPofReader share an IPofContext which contains the necessary meta-data, including type identifier to .NET type mappings.

The version identifier is used to support both backwards and forwards compatibility of serialized POF user types. Versioning of user types allows the addition of new properties to a user type, but not the replacement or removal of properties that existed in a previous version of the user type.

When a version v1 of a user type written by a IPofWriter is read by an IPofReader that supports version v2 of the same user type, the IPofReader returns default values for the additional properties of the User Type that exist in v2 but do not exist in v1. Conversely, when a version v2 of a user type written by a IPofWriter is read by an IPofReader that supports version v1 of the same user type, the instance of user type v1 must store those additional opaque properties for later encoding. The IPofReader enables the user type to store off the opaque properties in binary form (see ReadRemainder()()()()).

When the user type is re-encoded, it must be done so using the version identifier v2, since it is including the unaltered v2 properties. The opaque properties are subsequently included in the POF stream using the WriteRemainder(Binary) method.

Following the version identifier is an ordered sequence of index/value pairs, each of which is composed of a property index encoded as non-negative integer value whose value is greater than the previous property index, and a property value encoded as a POF value. The user type is finally terminated with an illegal property index of -1.

Note: To read a property that was written using a IPofWriter method, the corresponding read method on IPofReader must be used. For example, if a property was written using WriteByteArray(Int32, array<Byte>[]()[][]), ReadByteArray(Int32) must be used to read the property.

See Also