Namespace: | Sirenix.Serialization |
Assembly: | Sirenix.Serialization |
public abstract class BaseDataWriter : BaseDataReaderWriter, IDataWriter, IDisposable
If you inherit this class, it is VERY IMPORTANT that you implement each abstract method to the *exact* specifications the documentation specifies.
protected BaseDataWriter(Stream stream, SerializationContext context)
System.IO.Stream | stream | The base stream of the writer. |
SerializationContext | context | The serialization context to use. |
System.ArgumentNullException | The stream or context is null. |
System.ArgumentException | Cannot write to the stream. |
public SerializationContext Context { get; set; }
public virtual Stream Stream { get; set; }
System.ArgumentNullException | value |
System.ArgumentException | Cannot write to stream |
public abstract void BeginArrayNode(long length)
System.Int64 | length | The length of the array to come. |
This call MUST eventually be followed by a corresponding call to Sirenix.Serialization.IDataWriter.EndNode(System.String), with the same name.
public abstract void BeginReferenceNode(string name, Type type, int id)
System.String | name | The name of the reference node. |
System.Type | type | The type of the reference node. If null, no type metadata will be written. |
System.Int32 | id | The id of the reference node. This id is acquired by calling TryRegisterInternalReference(Object, out Int32). |
This call MUST eventually be followed by a corresponding call to Sirenix.Serialization.IDataWriter.EndNode(System.String), with the same name.
public abstract void BeginStructNode(string name, Type type)
System.String | name | The name of the struct node. |
System.Type | type | The type of the struct node. If null, no type metadata will be written. |
public abstract void Dispose()
public abstract void EndArrayNode()
public abstract void EndNode(string name)
System.String | name | The name of the node to end. This has to be the name of the current node. |
public virtual void FlushToStream()
public abstract string GetDataDump()
System.String |
public virtual void PrepareNewSerializationSession()
public abstract void WriteBoolean(string name, bool value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Boolean | value | The value to write. |
public abstract void WriteByte(string name, byte value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Byte | value | The value to write. |
public abstract void WriteChar(string name, char value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Char | value | The value to write. |
public abstract void WriteDecimal(string name, decimal value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Decimal | value | The value to write. |
public abstract void WriteDouble(string name, double value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Double | value | The value to write. |
public abstract void WriteExternalReference(string name, Guid guid)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Guid | guid | The value to write. |
public abstract void WriteExternalReference(string name, int index)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Int32 | index | The value to write. |
public abstract void WriteExternalReference(string name, string id)
System.String | name | The name of the value. If this is null, no name will be written. |
System.String | id | The value to write. |
public abstract void WriteGuid(string name, Guid value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Guid | value | The value to write. |
public abstract void WriteInt16(string name, short value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Int16 | value | The value to write. |
public abstract void WriteInt32(string name, int value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Int32 | value | The value to write. |
public abstract void WriteInt64(string name, long value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Int64 | value | The value to write. |
public abstract void WriteInternalReference(string name, int id)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Int32 | id | The value to write. |
public abstract void WriteNull(string name)
System.String | name | The name of the value. If this is null, no name will be written. |
public abstract void WritePrimitiveArray<T>(T[] array)
where T : struct
T[] | array | The primitive array to write. |
T | The element type of the primitive array. Valid element types can be determined using IsPrimitiveArrayType(Type). |
public abstract void WriteSByte(string name, sbyte value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.SByte | value | The value to write. |
public abstract void WriteSingle(string name, float value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.Single | value | The value to write. |
public abstract void WriteString(string name, string value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.String | value | The value to write. |
public abstract void WriteUInt16(string name, ushort value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.UInt16 | value | The value to write. |
public abstract void WriteUInt32(string name, uint value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.UInt32 | value | The value to write. |
public abstract void WriteUInt64(string name, ulong value)
System.String | name | The name of the value. If this is null, no name will be written. |
System.UInt64 | value | The value to write. |