Show / Hide Table of Contents

Interface IPofWriter

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.dll
Syntax
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(int, byte[]), ReadByteArray(int) must be used to read the property.

Properties

PofContext

Gets or sets the IPofContext object used by this IPofWriter to serialize user types into 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 = writer.PofContext;
try
{
    // switch to another IPofContext
    writer.PofContext = ...;

    // write POF data using the writer
}
finally
{
    // restore the original PofContext
    writer.PofContext = ctxOrig;
}

UserTypeId

Gets the user type that is currently being written.

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

The user type information, or -1 if the IPofWriter is not currently writing a user type.

VersionId

Gets or sets the version identifier of the user type that is currently being written.

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

The integer version ID of the user type; always non-negative.

Exceptions
Type Condition
ArgumentException

If the given version ID is negative.

InvalidOperationException

If no user type is being written.

Methods

CreateNestedPofWriter(int)

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

Declaration
IPofWriter CreateNestedPofWriter(int iProp)
Parameters
Type Name Description
int iProp

the property index

Returns
Type Description
IPofWriter

a PofWriter whose contents are nested into a single property of this PofWriter

Exceptions
Type Condition
ArgumentException

if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream

InvalidOperationException

if no user type is being written

IOException

if an I/O error occurs

CreateNestedPofWriter(int, int)

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

Declaration
IPofWriter CreateNestedPofWriter(int iProp, int nTypeId)
Parameters
Type Name Description
int iProp

the property index

int nTypeId

the type identifier of the nested property

Returns
Type Description
IPofWriter

a PofWriter whose contents are nested into a single property of this PofWriter

Exceptions
Type Condition
ArgumentException

if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream

InvalidOperationException

if no user type is being written

IOException

if an I/O error occurs

WriteArray(int, Array)

Write an Array property to the POF stream.

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

The property index.

Array array

The Object[] property value to write.

Remarks

Each element of the given array must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the array must be obtainable from the IPofContext associated with this IPofWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteArray(int, Array, Type)

Write a uniform Object[] property to the POF stream.

Declaration
void WriteArray(int index, Array array, Type type)
Parameters
Type Name Description
int index

The property index.

Array array

The Object[] property value to write.

Type type

The element type.

Remarks

Each element of the given array must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the array must be obtainable from the IPofContext associated with this IPofWriter.

Additionally, the type of each element must be equal to the specified type.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream; if the given property cannot be encoded into a POF stream; or if the type of one or more elements of the array is not equal to the specified type.

IOException

If an I/O error occurs.

WriteBinary(int, Binary)

Write a Binary property to the POF stream.

Declaration
void WriteBinary(int index, Binary bin)
Parameters
Type Name Description
int index

The property index.

Binary bin

The Binary property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteBoolean(int, bool)

Write a Boolean property to the POF stream.

Declaration
void WriteBoolean(int index, bool value)
Parameters
Type Name Description
int index

The property index.

bool value

The Boolean property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteBooleanArray(int, bool[])

Write a Boolean[] property to the POF stream.

Declaration
void WriteBooleanArray(int index, bool[] array)
Parameters
Type Name Description
int index

The property index.

bool[] array

The Boolean[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteByte(int, byte)

Write a Byte property to the POF stream.

Declaration
void WriteByte(int index, byte value)
Parameters
Type Name Description
int index

The property index.

byte value

The Byte property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteByteArray(int, byte[])

Write a Byte[] property to the POF stream.

Declaration
void WriteByteArray(int index, byte[] array)
Parameters
Type Name Description
int index

The property index.

byte[] array

The Byte[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteChar(int, char)

Write a Char property to the POF stream.

Declaration
void WriteChar(int index, char value)
Parameters
Type Name Description
int index

The property index.

char value

The Char property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteCharArray(int, char[])

Write a Char[] property to the POF stream.

Declaration
void WriteCharArray(int index, char[] array)
Parameters
Type Name Description
int index

The property index.

char[] array

The Char[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteCollection(int, ICollection)

Write an ICollection property to the POF stream.

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

The property index.

ICollection coll

The ICollection property value to write.

Remarks

Each element of the given array must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the array must be obtainable from the IPofContext associated with this IPofWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteCollection(int, ICollection, Type)

Write a uniform ICollection property to the POF stream.

Declaration
void WriteCollection(int index, ICollection coll, Type type)
Parameters
Type Name Description
int index

The property index.

ICollection coll

The ICollection property value to write.

Type type

The element type.

Remarks

Each element of the given collection must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the collection must be obtainable from the IPofContext associated with this IPofWriter.

Additionally, the type of each element must be equal to the specified type.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream; if the given property cannot be encoded into a POF stream; or if the type of one or more elements of the collection is not equal to the specified type.

IOException

If an I/O error occurs.

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

Write a generic ICollection<T> property to the POF stream.

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

The property index.

ICollection<T> coll

The ICollection<T> property value to write.

Type Parameters
Name Description
T

The type of the elements in the collection.

Remarks

Each element of the given array must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each key and value of the array must be obtainable from the IPofContext associated with this PofStreamWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteDate(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteDate(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes only year, month and day information of the specified DateTime object. No time information is encoded.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteDateTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteDateTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the year, month, day, hour, minute, second and millisecond information of the specified DateTime object. No timezone information is encoded.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteDayTimeInterval(int, TimeSpan)

Write a TimeSpan property to the POF stream.

Declaration
void WriteDayTimeInterval(int index, TimeSpan interval)
Parameters
Type Name Description
int index

The property index.

TimeSpan interval

The TimeSpan property value to write.

Remarks

This method encodes the day, hour, minute, second, and millisecond information of the specified TimeSpan object.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteDecimal(int, decimal)

Write a Decimal property to the POF stream.

Declaration
void WriteDecimal(int index, decimal value)
Parameters
Type Name Description
int index

The property index.

decimal value

The Decimal property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteDictionary(int, IDictionary)

Write an IDictionary property to the POF stream.

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

The property index.

IDictionary dict

The IDictionary property value to write.

Remarks

Each key and value of the given dictionary must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each key and value of the dictionary must be obtainable from the IPofContext associated with this IPofWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteDictionary(int, IDictionary, Type)

Write a uniform IDictionary property to the POF stream.

Declaration
void WriteDictionary(int index, IDictionary dict, Type keyType)
Parameters
Type Name Description
int index

The property index.

IDictionary dict

The IDictionary property value to write.

Type keyType

The type of all keys; must not be null.

Remarks

Each key and value of the given dictionary must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each key and value of the dictionary must be obtainable from the IPofContext associated with this IPofWriter.

Additionally, the type of each key must be equal to the specified type.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream; if the given property cannot be encoded into a POF stream; or if the type of one or more keys of the dictionary is not equal to the specified type.

IOException

If an I/O error occurs.

WriteDictionary(int, IDictionary, Type, Type)

Write a uniform IDictionary property to the POF stream.

Declaration
void WriteDictionary(int index, IDictionary dict, Type keyType, Type valueType)
Parameters
Type Name Description
int index

The property index.

IDictionary dict

The IDictionary property value to write.

Type keyType

The type of all keys; must not be null.

Type valueType

The type of all values; must not be null.

Remarks

Each key and value of the given dictionary must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each key and value of the dictionary must be obtainable from the IPofContext associated with this IPofWriter.

Additionally, the type of each key and value must be equal to the specified types.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream; if the given property cannot be encoded into a POF stream; or if the type of one or more keys or values of the dictionary is not equal to the specified types.

IOException

If an I/O error occurs.

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

Write a generic IDictionary<TKey, TValue> property to the POF stream.

Declaration
void WriteDictionary<TKey, TValue>(int index, IDictionary<TKey, TValue> dict)
Parameters
Type Name Description
int index

The property index.

IDictionary<TKey, TValue> dict

The IDictionary<TKey, TValue> property value to write.

Type Parameters
Name Description
TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Remarks

Each key and value of the given dictionary must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each key and value of the dictionary must be obtainable from the IPofContext associated with this PofStreamWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteDouble(int, double)

Write a Double property to the POF stream.

Declaration
void WriteDouble(int index, double value)
Parameters
Type Name Description
int index

The property index.

double value

The Double property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteDoubleArray(int, double[])

Write a Double[] property to the POF stream.

Declaration
void WriteDoubleArray(int index, double[] array)
Parameters
Type Name Description
int index

The property index.

double[] array

The Double[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt16(int, short)

Write an Int16 property to the POF stream.

Declaration
void WriteInt16(int index, short value)
Parameters
Type Name Description
int index

The property index.

short value

The Int16 property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt16Array(int, short[])

Write an Int16[] property to the POF stream.

Declaration
void WriteInt16Array(int index, short[] array)
Parameters
Type Name Description
int index

The property index.

short[] array

The Int16[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt32(int, int)

Write an Int32 property to the POF stream.

Declaration
void WriteInt32(int index, int value)
Parameters
Type Name Description
int index

The property index.

int value

The Int32 property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt32Array(int, int[])

Write an Int32[] property to the POF stream.

Declaration
void WriteInt32Array(int index, int[] array)
Parameters
Type Name Description
int index

The property index.

int[] array

The Int32[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt64(int, long)

Write an Int64 property to the POF stream.

Declaration
void WriteInt64(int index, long value)
Parameters
Type Name Description
int index

The property index.

long value

The Int64 property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteInt64Array(int, long[])

Write an Int64[] property to the POF stream.

Declaration
void WriteInt64Array(int index, long[] array)
Parameters
Type Name Description
int index

The property index.

long[] array

The Int64[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteLocalDateTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteLocalDateTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the year, month, day, hour, minute, second, millisecond and timezone information of the specified DateTime object.

Specified value is converted to the local time before it is written to the POF stream.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteLocalTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteLocalTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the hour, minute, second, millisecond and timezone information of the specified DateTime object. No year, month or day information is encoded.

Specified value is converted to the local time before it is written to the POF stream.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteLongArray(int, ILongArray)

Write an ILongArray property to the POF stream.

Declaration
void WriteLongArray(int index, ILongArray la)
Parameters
Type Name Description
int index

The propertie index.

ILongArray la

The ILongArray property to write.

Remarks

Each element of the given ILongArray must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the ILongArray must be obtainable from the IPofContext associated with this PofWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

ArgumentException

If the given property cannot be encoded into a POF stream.

IOException

If an I/O error ocurs.

WriteLongArray(int, ILongArray, Type)

Write a uniform ILongArray property to the POF stream.

Declaration
void WriteLongArray(int index, ILongArray la, Type type)
Parameters
Type Name Description
int index

The property index.

ILongArray la

The ILongArray property to write.

Type type

The class of all elements; must not be null.

Remarks

Each element of the given ILongArray must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for each element of the ILongArray must be obtainable from the IPofContext associated with this PofStreamWriter.

Additionally, the type of each element must be equal to the specified class.
Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

ArgumentException

If the given property cannot be encoded into a POF stream.

ArgumentException

If the type of one or more elements of the ILongArray is not equal to the specified class.

IOException

If an I/O error occurs.

WriteObject(int, object)

Write an Object property to the POF stream.

Declaration
void WriteObject(int index, object o)
Parameters
Type Name Description
int index

The property index.

object o

The Object property value to write.

Remarks

The given object must be an instance (or an array of instances) of one of the following:

  • Boolean
  • Byte
  • Char
  • Int16
  • Int32
  • Int64
  • Single
  • Double
  • Decimal
  • Binary
  • String
  • DateTime
  • TimeSpan
  • ICollection
  • ILongArray
  • RawTime
  • RawDateTime
  • RawYearMonthInterval
  • IPortableObject

Otherwise, an IPofSerializer for the object must be obtainable from the IPofContext associated with this IPofWriter.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream, or if the given property cannot be encoded into a POF stream.

IOException

If an I/O error occurs.

WriteRawDateTime(int, RawDateTime)

Write a RawDateTime property to the POF stream.

Declaration
void WriteRawDateTime(int index, RawDateTime value)
Parameters
Type Name Description
int index

The property index.

RawDateTime value

The RawDateTime property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteRawInt128(int, RawInt128)

Write an RawInt128 property to the POF stream.

Declaration
void WriteRawInt128(int index, RawInt128 value)
Parameters
Type Name Description
int index

The property index.

RawInt128 value

The RawInt128 property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteRawTime(int, RawTime)

Write a RawTime property to the POF stream.

Declaration
void WriteRawTime(int index, RawTime value)
Parameters
Type Name Description
int index

The property index.

RawTime value

The RawTime property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteRawYearMonthInterval(int, RawYearMonthInterval)

Write a RawYearMonthInterval property to the POF stream.

Declaration
void WriteRawYearMonthInterval(int index, RawYearMonthInterval interval)
Parameters
Type Name Description
int index

The property index.

RawYearMonthInterval interval

The RawYearMonthInterval property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteRemainder(Binary)

Write the remaining properties to the POF stream, terminating the writing of the currrent user type.

Declaration
void WriteRemainder(Binary properties)
Parameters
Type Name Description
Binary properties

A Binary object containing zero or more indexed properties in binary POF encoded form; may be null.

Remarks

As part of writing out a user type, this method must be called by the IPofSerializer that is writing out the user type, or the POF stream will be corrupted.

Calling this method terminates the current user type by writing a -1 to the POF stream after the last indexed property. Subsequent calls to the various WriteXYZ methods of this interface will fail after this method is called.

Exceptions
Type Condition
InvalidOperationException

If no user type is being written.

IOException

If an I/O error occurs.

WriteSingle(int, float)

Write a Single property to the POF stream.

Declaration
void WriteSingle(int index, float value)
Parameters
Type Name Description
int index

The property index.

float value

The Single property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteSingleArray(int, float[])

Write a Single[] property to the POF stream.

Declaration
void WriteSingleArray(int index, float[] array)
Parameters
Type Name Description
int index

The property index.

float[] array

The Single[] property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteString(int, string)

Write a String property to the POF stream.

Declaration
void WriteString(int index, string value)
Parameters
Type Name Description
int index

The property index.

string value

The String property value to write.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the hour, minute, second and millisecond information of the specified DateTime object. No year, month, day or timezone information is encoded.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteTimeInterval(int, TimeSpan)

Write a TimeSpan property to the POF stream.

Declaration
void WriteTimeInterval(int index, TimeSpan interval)
Parameters
Type Name Description
int index

The property index.

TimeSpan interval

The TimeSpan property value to write.

Remarks

This method encodes the hour, minute, second, and millisecond information of the specified TimeSpan object.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteUniversalDateTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteUniversalDateTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the year, month, day, hour, minute, second, millisecond and timezone information of the specified DateTime object.

Specified value is converted to UTC time before it is written to the POF stream.

Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

WriteUniversalTime(int, DateTime)

Write a DateTime property to the POF stream in ISO8601 format.

Declaration
void WriteUniversalTime(int index, DateTime value)
Parameters
Type Name Description
int index

The property index.

DateTime value

The DateTime property value to write.

Remarks

This method encodes the hour, minute, second, millisecond and timezone information of the specified DateTime object. No year, month or day information is encoded.

Specified value is converted to the UTC time before it is written to the POF stream.
Exceptions
Type Condition
ArgumentException

If the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream.

IOException

If an I/O error occurs.

See Also

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