Namespace: | Sirenix.Serialization |
Assembly: | Sirenix.Serialization |
public class JsonDataReader : BaseDataReader, IDataReader, IDisposable
public JsonDataReader()
public JsonDataReader(Stream stream, DeserializationContext context)
System.IO.Stream | stream | The base stream of the reader. |
DeserializationContext | context | The deserialization context to use. |
public override Stream Stream { get; set; }
public override void Dispose()
This call MUST (eventually) be followed by a corresponding call to
This call will change the values of the Sirenix.Serialization.IDataReader.IsInArrayNode, Sirenix.Serialization.IDataReader.CurrentNodeName, Sirenix.Serialization.IDataReader.CurrentNodeId and Sirenix.Serialization.IDataReader.CurrentNodeDepth properties to the correct values for the current array node.
public override bool EnterArray(out long length)
System.Int64 | length | The length of the array that was entered. |
System.Boolean |
|
This call MUST (eventually) be followed by a corresponding call to
This call will change the values of the Sirenix.Serialization.IDataReader.IsInArrayNode, Sirenix.Serialization.IDataReader.CurrentNodeName, Sirenix.Serialization.IDataReader.CurrentNodeId and Sirenix.Serialization.IDataReader.CurrentNodeDepth properties to the correct values for the current node.
public override bool EnterNode(out Type type)
System.Type | type | The type of the node. This value will be null if there was no metadata, or if the reader's serialization binder failed to resolve the type name. |
System.Boolean |
|
This call MUST have been preceded by a corresponding call to Sirenix.Serialization.IDataReader.EnterArray(System.Int64@).
This call will change the values of the Sirenix.Serialization.IDataReader.IsInArrayNode, Sirenix.Serialization.IDataReader.CurrentNodeName, Sirenix.Serialization.IDataReader.CurrentNodeId and Sirenix.Serialization.IDataReader.CurrentNodeDepth to the correct values for the node that was prior to the exited array node.
public override bool ExitArray()
System.Boolean |
|
This call MUST have been preceded by a corresponding call to Sirenix.Serialization.IDataReader.EnterNode(System.Type@).
This call will change the values of the Sirenix.Serialization.IDataReader.IsInArrayNode, Sirenix.Serialization.IDataReader.CurrentNodeName, Sirenix.Serialization.IDataReader.CurrentNodeId and Sirenix.Serialization.IDataReader.CurrentNodeDepth to the correct values for the node that was prior to the current node.
public override bool ExitNode()
System.Boolean |
|
public override string GetDataDump()
System.String |
protected override EntryType PeekEntry()
EntryType | The peeked entry. |
public override EntryType PeekEntry(out string name)
System.String | name | The name of the next entry, if it has one. |
EntryType | The type of the next entry. |
public override void PrepareNewSerializationSession()
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadBoolean(out bool value)
System.Boolean | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.Byte.MinValue or larger than System.Byte.MaxValue, the result will be default(System.Byte).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadByte(out byte value)
System.Byte | value | The value that has been read. |
System.Boolean |
|
If the string of the entry is longer than 1 character, the first character of the string will be taken as the result.
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadChar(out char value)
System.Char | value | The value that has been read. |
System.Boolean |
|
If the stored integer or floating point value is smaller than System.Decimal.MinValue or larger than System.Decimal.MaxValue, the result will be default(System.Decimal).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadDecimal(out decimal value)
System.Decimal | value | The value that has been read. |
System.Boolean |
|
If the stored integer or floating point value is smaller than System.Double.MinValue or larger than System.Double.MaxValue, the result will be default(System.Double).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadDouble(out double value)
System.Double | value | The value that has been read. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadExternalReference(out Guid guid)
System.Guid | guid | The external reference guid. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadExternalReference(out int index)
System.Int32 | index | The external reference index. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadExternalReference(out string id)
System.String | id | The external reference string. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadGuid(out Guid value)
System.Guid | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.Int16.MinValue or larger than System.Int16.MaxValue, the result will be default(System.Int16).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadInt16(out short value)
System.Int16 | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.Int32.MinValue or larger than System.Int32.MaxValue, the result will be default(System.Int32).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadInt32(out int value)
System.Int32 | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.Int64.MinValue or larger than System.Int64.MaxValue, the result will be default(System.Int64).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadInt64(out long value)
System.Int64 | value | The value that has been read. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadInternalReference(out int id)
System.Int32 | id | The internal reference id. |
System.Boolean |
|
null
value. This call will succeed if the next entry is an Null.
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadNull()
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadPrimitiveArray<T>(out T[] array)
where T : struct
T[] | array | The resulting primitive array. |
System.Boolean |
|
T | The element type of the primitive array. Valid element types can be determined using IsPrimitiveArrayType(Type). |
System.ArgumentException | Type + typeof(T).Name + is not a valid primitive array type. |
If the value of the stored integer is smaller than System.SByte.MinValue or larger than System.SByte.MaxValue, the result will be default(System.SByte).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadSByte(out sbyte value)
System.SByte | value | The value that has been read. |
System.Boolean |
|
If the stored integer or floating point value is smaller than System.Single.MinValue or larger than System.Single.MaxValue, the result will be default(System.Single).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadSingle(out float value)
System.Single | value | The value that has been read. |
System.Boolean |
|
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadString(out string value)
System.String | value | The value that has been read. |
System.Boolean |
|
protected override EntryType ReadToNextEntry()
EntryType | The next entry. |
If the value of the stored integer is smaller than System.UInt16.MinValue or larger than System.UInt16.MaxValue, the result will be default(System.UInt16).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadUInt16(out ushort value)
System.UInt16 | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.UInt32.MinValue or larger than System.UInt32.MaxValue, the result will be default(System.UInt32).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadUInt32(out uint value)
System.UInt32 | value | The value that has been read. |
System.Boolean |
|
If the value of the stored integer is smaller than System.UInt64.MinValue or larger than System.UInt64.MaxValue, the result will be default(System.UInt64).
If the call fails (and returns false
), it will skip the current entry value, unless that entry is an EndOfNode or an EndOfArray.
public override bool ReadUInt64(out ulong value)
System.UInt64 | value | The value that has been read. |
System.Boolean |
|