Class PofStreamWriter
IPofWriter implementation that writes POF-encoded data to a POF stream.
Implements
Inherited Members
Namespace: Tangosol.IO.Pof
Assembly: Coherence.dll
Syntax
public class PofStreamWriter : IPofWriter
Constructors
PofStreamWriter(DataWriter, IPofContext)
Construct a new PofStreamWriter that will write a POF stream to the passed DataWriter object.
Declaration
public PofStreamWriter(DataWriter writer, IPofContext ctx)
Parameters
Type | Name | Description |
---|---|---|
DataWriter | writer | The DataWriter object to write to; must not be
|
IPofContext | ctx | The IPofContext used by the new
PofStreamWriter to serialize user types; must not be
|
PofStreamWriter(WritingPofHandler, IPofContext)
Construct a new PofStreamWriter that will write a POF stream using the passed WritingPofHandler.
Declaration
public PofStreamWriter(WritingPofHandler handler, IPofContext ctx)
Parameters
Type | Name | Description |
---|---|---|
WritingPofHandler | handler | The WritingPofHandler used for writing; must not be
|
IPofContext | ctx | The IPofContext used by the new
PofStreamWriter to serialize user types; must not be
|
Fields
m_ctx
The IPofContext used by this PofStreamWriter to serialize user types.
Declaration
protected IPofContext m_ctx
Field Value
Type | Description |
---|---|
IPofContext |
m_evolvable
A flag to indicate if the object to be written is either evolvable or part of an evolvable object.
Declaration
protected bool m_evolvable
Field Value
Type | Description |
---|---|
bool |
m_handler
The WritingPofHandler used to write a POF stream.
Declaration
protected WritingPofHandler m_handler
Field Value
Type | Description |
---|---|
WritingPofHandler |
m_refs
If references are used, then this is the ReferenceLibrary
Declaration
protected PofStreamWriter.ReferenceLibrary m_refs
Field Value
Type | Description |
---|---|
PofStreamWriter.ReferenceLibrary |
m_writer
The Stream object that the PofStreamWriter writes to.
Declaration
protected DataWriter m_writer
Field Value
Type | Description |
---|---|
DataWriter |
Properties
IsEvolvable
Gets or sets the flag that indicate if the object to be written is either evolvable or part of an evolvable object.
Declaration
protected virtual bool IsEvolvable { get; set; }
Property Value
Type | Description |
---|---|
bool | True iff the object to be written is Evolvable. |
PofContext
Gets or sets the IPofContext object used by this PofStreamWriter to serialize user types into a POF stream.
Declaration
public virtual 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; }
PofHandler
Gets the WritingPofHandler used internally by this PofStreamWriter to write the POF stream.
Declaration
protected virtual WritingPofHandler PofHandler { get; }
Property Value
Type | Description |
---|---|
WritingPofHandler | The IPofHandler. |
UserTypeId
Gets the user type that is currently being written.
Declaration
public virtual int UserTypeId { get; }
Property Value
Type | Description |
---|---|
int | The user type information, or -1 if the PofStreamWriter is not currently writing a user type. |
VersionId
Gets or sets the version identifier of the user type that is currently being written.
Declaration
public virtual 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
AssertEqual(Type, Type)
Assert that a class is equal to another class.
Declaration
protected static void AssertEqual(Type type, Type testType)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The expected class; must not be |
Type | testType | The class to test for equality; must not be |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the second class is not equal to the first. |
BeginProperty(int)
Report that a POF property is about to be written to the POF stream.
Declaration
protected virtual void BeginProperty(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the property being written. |
Remarks
This method call will be followed by one or more separate calls to a "write" method and the property extent will then be terminated by a call to EndProperty(int).
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
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
public virtual 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
public virtual 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 |
EnableReference()
Ensure that reference support (necessary for cyclic dependencies) is enabled.
Declaration
public virtual void EnableReference()
EndProperty(int)
Signifies the termination of the current POF property.
Declaration
protected virtual void EndProperty(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the current property. |
IsReferenceEnabled()
Determine if reference support is enabled.
Declaration
public bool IsReferenceEnabled()
Returns
Type | Description |
---|---|
bool | true iff reference support is enabled |
OnException(Exception)
Called when an unexpected exception is caught while writing to the POF stream.
Declaration
protected virtual void OnException(Exception e)
Parameters
Type | Name | Description |
---|---|---|
Exception | e | The exception. |
Remarks
If the given exception wraps an IOException, the IOException is unwrapped and rethrown; otherwise the given exception is rethrown.
Exceptions
Type | Condition |
---|---|
IOException | The wrapped IOException, if the given exception is a wrapped IOException. |
WriteArray(int, Array)
Write an Object[] property to the POF stream.
Declaration
public virtual 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
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteArray(int, Array, Type)
Write an uniform Object[] property to the POF stream.
Declaration
public virtual 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 type of all elements; must not be |
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 the object 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 |
IOException | If an I/O error occurs. |
WriteBinary(int, Binary)
Write a Binary property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteBoolean(int, bool)
Write a Boolean property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteBooleanArray(int, bool[])
Write a Boolean[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteByte(int, byte)
Write a Byte property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteByteArray(int, byte[])
Write a Byte[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteChar(int, char)
Write a Char property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteCharArray(int, char[])
Write a Char[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteCollection(int, ICollection)
Write an ICollection property to the POF stream.
Declaration
public virtual 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 PofStreamWriter.
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteCollection(int, ICollection, Type)
Write a uniform ICollection property to the POF stream.
Declaration
public virtual 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 PofStreamWriter.
Additionally, the type of each element must be equal to the specified type.
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteCollection<T>(int, ICollection<T>)
Write a generic ICollection<T> property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDate(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDateTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDayTimeInterval(int, TimeSpan)
Write a TimeSpan property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDecimal(int, decimal)
Write a Decimal property to the POF stream.
Declaration
public virtual 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
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDictionary(int, IDictionary, Type)
Write a uniform IDictionary property to the POF stream.
Declaration
public virtual 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 |
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 |
IOException | If an I/O error occurs. |
WriteDictionary(int, IDictionary, Type, Type)
Write a uniform IDictionary property to the POF stream.
Declaration
public virtual 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 |
Type | valueType | The type of all values; must not be |
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 |
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
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDouble(int, double)
Write a Double property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteDoubleArray(int, double[])
Write a Double[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt16(int, short)
Write an Int16 property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt16Array(int, short[])
Write an Int16[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt32(int, int)
Write an Int32 property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt32Array(int, int[])
Write an Int32[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt64(int, long)
Write an Int64 property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteInt64Array(int, long[])
Write an Int64[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteLocalDateTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public virtual 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.
Specifiedvalue
is converted to the local
time before it is written to the POF stream.
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteLocalTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public 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 |
IOException | If an I/O error occurs. |
WriteLongArray(int, ILongArray)
Write an ILongArray property to the POF stream.
Declaration
public virtual 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
public virtual 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
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
public virtual 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 PofStreamWriter.
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteRawDateTime(int, RawDateTime)
Write a RawDateTime property to the POF stream.
Declaration
public virtual 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
public 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 |
IOException | If an I/O error occurs. |
WriteRawTime(int, RawTime)
Write a RawTime property to the POF stream.
Declaration
public void WriteRawTime(int index, RawTime time)
Parameters
Type | Name | Description |
---|---|---|
int | index | The property index. |
RawTime | time | The RawTime property value to write. |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteRawYearMonthInterval(int, RawYearMonthInterval)
Write a RawYearMonthInterval property to the POF stream.
Declaration
public virtual 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 |
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
public virtual 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 |
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
public virtual 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 |
IOException | If an I/O error occurs. |
WriteSingleArray(int, float[])
Write a Single[] property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteString(int, string)
Write a String property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteTimeInterval(int, TimeSpan)
Write a TimeSpan property to the POF stream.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteUniversalDateTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public virtual 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 |
IOException | If an I/O error occurs. |
WriteUniversalTime(int, DateTime)
Write a DateTime property to the POF stream in ISO8601 format.
Declaration
public 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.
Specifiedvalue
is converted to the UTC time
before it is written to the POF stream.
Exceptions
Type | Condition |
---|---|
ArgumentException | If the property |
IOException | If an I/O error occurs. |
WriteUserType(int, object)
Write an instance of a user type to the POF stream at the specified index.
Declaration
protected void WriteUserType(int iProp, object o)
Parameters
Type | Name | Description |
---|---|---|
int | iProp | The property index. |
object | o | The user type instance. |