Class JsonDataWriter
Provides methods for sequential writing of data in the Json format.
Inherited Members
Namespace: Terrasoft.Common
Assembly: Terrasoft.Common.dll
Syntax
public class JsonDataWriter : DataWriter, IDataWriter, IDisposable
Constructors
JsonDataWriter(JsonDataWriterSettings, Stream)
Initializes an instance of the JsonDataWriter class using the specified settings of the instance and output stream.
Declaration
public JsonDataWriter(JsonDataWriterSettings settings, Stream output)
Parameters
Type | Name | Description |
---|---|---|
JsonDataWriterSettings | settings | Settings for the XmlDataWriter new instance. |
System.IO.Stream | output | The stream to write to. |
JsonDataWriter(JsonDataWriterSettings, TextWriter)
Initializes an instance of the JsonDataWriter class using the specified settings of the instance and System.IO.TextWriter.
Declaration
public JsonDataWriter(JsonDataWriterSettings settings, TextWriter output)
Parameters
Type | Name | Description |
---|---|---|
JsonDataWriterSettings | settings | Settings for the JsonDataWriter new instance. |
System.IO.TextWriter | output | The System.IO.TextWriter instance that writes. |
Properties
JsonWriter
Declaration
protected JsonWriter JsonWriter { get; }
Property Value
Type | Description |
---|---|
Newtonsoft.Json.JsonWriter |
Settings
Gets settings of the current JsonDataWriter instance.
Declaration
public JsonDataWriterSettings Settings { get; }
Property Value
Type | Description |
---|---|
JsonDataWriterSettings |
Methods
Close()
Closes the current JsonDataWriter instance.
Declaration
public override void Close()
Overrides
Dispose(Boolean)
Deletes, releases and resets resources. Cancels the Finalize() call for this instance.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Overrides
WriteFinishCollection()
Completes writing of the current collection.
Declaration
public override void WriteFinishCollection()
Overrides
WriteFinishObject()
Finishes writing the current object.
Declaration
public override void WriteFinishObject()
Overrides
Remarks
The method writes a closing brace to the output stream.
WriteRawValue(String, Object)
Declaration
public override void WriteRawValue(string name, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.Object | value |
Overrides
WriteSerializableObjectValue(String, Object, Object)
Records the created serialized value with the specified name and default value.
Declaration
public override void WriteSerializableObjectValue(string name, object value, object defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Object | value | The serialized value of the property that is being loaded. |
System.Object | defValue | The default value. |
Overrides
WriteStartCollection(String)
Begins writing of collection with the specified name.
Declaration
public override void WriteStartCollection(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the collection. |
Overrides
WriteStartObject()
Writes opening brace to the output stream.
Declaration
public override void WriteStartObject()
Overrides
WriteStartObject(String)
Begins to write an object with the specified name to the output stream.
Declaration
public override void WriteStartObject(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Object name. |
Overrides
Remarks
The method writes object name and opening brace to the output stream.
WriteValue(Object[])
Writes the specified value-type array.
Declaration
public override void WriteValue(params object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | values | The value-type array. |
Overrides
WriteValue(String, Boolean, Boolean)
Records the value of the System.Boolean type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, bool value, bool defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Boolean | value | The value of the property of the System.Boolean type. |
System.Boolean | defValue | The default value. |
Overrides
WriteValue(String, DateTime, DateTime)
Records the value of the System.DateTime type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, DateTime value, DateTime defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.DateTime | value | The value of the property of the System.DateTime type. |
System.DateTime | defValue | The default value. |
Overrides
WriteValue(String, Decimal, Decimal)
Records the value of the System.Decimal type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, decimal value, decimal defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Decimal | value | The value of the property of the System.Decimal type. |
System.Decimal | defValue | The default value. |
Overrides
WriteValue(String, Double, Double)
Records the value of the System.Double type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, double value, double defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Double | value | The value of the property of the System.Double type. |
System.Double | defValue | The default value. |
Overrides
WriteValue(String, Enum, Enum)
Records the value of the System.Enum type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, Enum value, Enum defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Enum | value | The value of the property of the System.Enum type. |
System.Enum | defValue | The default value. |
Overrides
WriteValue(String, Guid, Guid)
Records the value of the System.Guid type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, Guid value, Guid defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Guid | value | The value of the property of the System.Guid type. |
System.Guid | defValue | The default value. |
Overrides
WriteValue(String, Int32, Int32)
Records the value of the System.Int32 type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, int value, int defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Int32 | value | The value of the property of the System.Int32 type. |
System.Int32 | defValue | The default value. |
Overrides
WriteValue(String, Stream)
Records value from the specified stream for the property with the specified name.
Declaration
public override void WriteValue(string name, Stream value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.IO.Stream | value | The stream the record is made from. |
Overrides
WriteValue(String, String, String)
Records the value of the System.String type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, string value, string defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.String | value | The value of the property of the System.String type. |
System.String | defValue | The default value for the property. |
Overrides
WriteValue(String, Type, Object, Object)
Records the value of the specified type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, Type valueType, object value, object defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
System.Type | valueType | The type of value. |
System.Object | value | Value. |
System.Object | defValue | The default value. |
Overrides
Exceptions
Type | Condition |
---|---|
UnsupportedTypeException | When passing as a parameter |
System.ArgumentNullException | When passing an empty string or |
InvalidTypeCastException | When attempting to convert |
WriteValue(String, DataConverter, Object, Object)
Records property value with the specified name and value
value, converted with the specified converter
.
Declaration
public override void WriteValue(string name, DataConverter converter, object value, object defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
DataConverter | converter | Data type converter. |
System.Object | value | Value. |
System.Object | defValue | The default value. |
Overrides
WriteValue(String, LocalizableString, LocalizableString)
Records the value of the LocalizableString type for a property with the specified name and default value.
Declaration
public override void WriteValue(string name, LocalizableString value, LocalizableString defValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Property name. |
LocalizableString | value | The value of the property of the LocalizableString type. |
LocalizableString | defValue | The default value. |