C# Class DotAmf.Serialization.DataContractAmfSerializer

Serializes objects to the Action Message Format (AMF) and deserializes AMF data to objects.
This class is thread-safe and is expensive to instantiate.
Inheritance: System.Runtime.Serialization.XmlObjectSerializer
ファイルを表示 Open project: artema/DotAmf Class Usage Examples

Public Methods

Method Description
DataContractAmfSerializer ( Type type ) : System

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type.

DataContractAmfSerializer ( Type type, AmfEncodingOptions encodingOptions ) : System

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type.

DataContractAmfSerializer ( Type type, IEnumerable knownTypes ) : System

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type, and a collection of known types that may be present in the object graph.

DataContractAmfSerializer ( Type type, IEnumerable knownTypes, AmfEncodingOptions encodingOptions ) : System

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type, and a collection of known types that may be present in the object graph.

IsStartObject ( XmlDictionaryReader reader ) : bool

Gets a value that specifies whether the XmlDictionaryReader is positioned over an AMFX element that represents an object the serializer can deserialize from.

IsStartObject ( XmlReader reader ) : bool

Gets a value that specifies whether the XmlReader is positioned over an AMFX element that represents an object the serializer can deserialize from.

ReadObject ( Stream stream ) : object

Reads a document stream in the AMF (Action Message Format) format and returns the deserialized object.

ReadObject ( XmlDictionaryReader reader ) : object

Reads the XML document mapped from AMFX (Action Message Format in XML) with an XmlDictionaryReader and returns the deserialized object.

ReadObject ( XmlDictionaryReader reader, bool verifyObjectName ) : object

Reads the AMFX document mapped from AMF with an XmlDictionaryReader and returns the deserialized object; it also enables you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to deserialize.

ReadObject ( XmlReader reader ) : object

Reads the XML document mapped from AMFX (Action Message Format in XML) with an XmlReader and returns the deserialized object.

ReadObject ( XmlReader reader, bool verifyObjectName ) : object

Reads the AMFX document mapped from AMF with an XmlReader and returns the deserialized object; it also enables you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to deserialize.

ReadObject ( Stream stream, XmlWriter output ) : void

Reads a document stream in the AMF (Action Message Format) format and writes it in the AMFX (Action Message Format in XML) format,

WriteEndObject ( XmlDictionaryWriter writer ) : void
WriteEndObject ( XmlWriter writer ) : void
WriteObject ( Stream stream, XmlReader input ) : void

Reads a specified Action Message Format in XML (AMFX) data and writes the resulting AMF data to a stream.

WriteObject ( Stream stream, object graph ) : void

Serializes a specified object to Action Message Format (AMF) data and writes the resulting AMF to a stream.

WriteObject ( XmlWriter writer, object graph ) : void

Serializes an object to XML that may be mapped to Action Message Format in XML (AMFX). Writes all the object data, including the starting XML element, content, and closing element, with an XmlWriter.

WriteObjectContent ( XmlDictionaryWriter writer, object graph ) : void

Writes the XML content that can be mapped to Action Message Format (AMF) using an XmlDictionaryWriter.

WriteObjectContent ( XmlWriter writer, object graph ) : void

Writes the XML content that can be mapped to Action Message Format (AMF) using an XmlWriter.

WriteStartObject ( XmlDictionaryWriter writer, object graph ) : void
WriteStartObject ( XmlWriter writer, object graph ) : void

Private Methods

Method Description
CreateDecoder ( AmfEncodingOptions encodingOptions ) : IAmfDecoder

Create AMF decoder.

CreateDefaultOptions ( ) : AmfEncodingOptions

Create default AMF encoding options.

CreateEncoder ( AmfEncodingOptions encodingOptions ) : IAmfEncoder

Create AMF encoder.

Deserialize ( XmlReader reader, SerializationContext context ) : object

Deserialize AMFX data.

DeserializePacket ( XmlReader reader, SerializationContext context ) : object

Deserialize an AMFX packet.

GetAmfxType ( Type type, bool &isDataContract ) : string

Get AMFX type for a CLR type.

GetEnumValue ( SerializationContext context, Type type, object value ) : object

Get a string representation of the enum value.

PrepareDataContract ( Type type ) : DataContractDescriptor>.KeyValuePair

Prepare a data contract.

PrepareDataContracts ( IEnumerable knownTypes ) : DataContractDescriptor>.Dictionary

Prepare data contracts.

ReadArray ( XmlReader reader, SerializationContext context ) : object
ReadByteArray ( XmlReader reader, SerializationContext context ) : byte[]
ReadDate ( XmlReader reader, SerializationContext context ) : System.DateTime
ReadDouble ( XmlReader reader ) : double
ReadInteger ( XmlReader reader ) : int
ReadObject ( XmlReader reader, SerializationContext context ) : object
ReadReference ( XmlReader reader, SerializationContext context ) : object
ReadString ( XmlReader reader, SerializationContext context ) : string
ReadXml ( XmlReader reader, SerializationContext context ) : System.Xml.Linq.XDocument
Serialize ( XmlWriter writer, object value, SerializationContext context ) : void

Serialize AMFX data.

SerializePacket ( XmlWriter writer, object graph, SerializationContext context ) : void

Serialize an AMFX packet.

WriteArray ( XmlWriter writer, object value, SerializationContext context ) : void

Write an array.

WriteByteArray ( XmlWriter writer, byte value, SerializationContext context ) : void

Write a byte array.

WriteDataContract ( XmlWriter writer, object graph, Type type, SerializationContext context, bool isDataContract ) : void

Write an object.

WriteDate ( XmlWriter writer, System.DateTime value, SerializationContext context ) : void

Write a date.

WriteElement ( XmlWriter writer, string elementName, string value, string>.IEnumerable attributes = null ) : void

Write an element.

WriteEmptyElement ( XmlWriter writer, string elementName, string>.IEnumerable attributes = null ) : void

Write an empty element.

WriteString ( XmlWriter writer, string value, SerializationContext context ) : void

Write a string.

WriteXml ( XmlWriter writer, System.Xml.Linq.XDocument value, SerializationContext context ) : void

Write an XML.

Method Details

DataContractAmfSerializer() public method

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type.
At least one of the types being serialized or deserialized does not conform to data contract rules. /// For example, the DataContractAttribute attribute has not been applied to the type.
public DataContractAmfSerializer ( Type type ) : System
type System.Type A Type that specifies the type of the instances that is serialized or deserialized.
return System

DataContractAmfSerializer() public method

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type.
At least one of the types being serialized or deserialized does not conform to data contract rules. /// For example, the DataContractAttribute attribute has not been applied to the type.
public DataContractAmfSerializer ( Type type, AmfEncodingOptions encodingOptions ) : System
type System.Type A Type that specifies the type of the instances that is serialized or deserialized.
encodingOptions DotAmf.Data.AmfEncodingOptions AMF encoding options.
return System

DataContractAmfSerializer() public method

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type, and a collection of known types that may be present in the object graph.
At least one of the types being serialized or deserialized does not conform to data contract rules. /// For example, the DataContractAttribute attribute has not been applied to the type.
public DataContractAmfSerializer ( Type type, IEnumerable knownTypes ) : System
type System.Type A Type that specifies the type of the instances that is serialized or deserialized.
knownTypes IEnumerable An IEnumerable of Type that contains the types that may be present in the object graph.
return System

DataContractAmfSerializer() public method

Initializes a new instance of the DataContractAmfSerializer class to serialize or deserialize an object of the specified type, and a collection of known types that may be present in the object graph.
At least one of the types being serialized or deserialized does not conform to data contract rules. /// For example, the DataContractAttribute attribute has not been applied to the type.
public DataContractAmfSerializer ( Type type, IEnumerable knownTypes, AmfEncodingOptions encodingOptions ) : System
type System.Type A Type that specifies the type of the instances that is serialized or deserialized.
knownTypes IEnumerable An IEnumerable of Type that contains the types that may be present in the object graph.
encodingOptions DotAmf.Data.AmfEncodingOptions AMF encoding options.
return System

IsStartObject() public method

Gets a value that specifies whether the XmlDictionaryReader is positioned over an AMFX element that represents an object the serializer can deserialize from.
public IsStartObject ( XmlDictionaryReader reader ) : bool
reader System.Xml.XmlDictionaryReader The XmlDictionaryReader used to read the AMFX stream mapped from AMF.
return bool

IsStartObject() public method

Gets a value that specifies whether the XmlReader is positioned over an AMFX element that represents an object the serializer can deserialize from.
public IsStartObject ( XmlReader reader ) : bool
reader XmlReader The XmlReader used to read the AMFX stream mapped from AMF.
return bool

ReadObject() public method

Reads a document stream in the AMF (Action Message Format) format and returns the deserialized object.
Unable to resolve data contracts.
public ReadObject ( Stream stream ) : object
stream Stream The Stream to be read.
return object

ReadObject() public method

Reads the XML document mapped from AMFX (Action Message Format in XML) with an XmlDictionaryReader and returns the deserialized object.
Unable to resolve data contracts.
public ReadObject ( XmlDictionaryReader reader ) : object
reader System.Xml.XmlDictionaryReader XML reader.
return object

ReadObject() public method

Reads the AMFX document mapped from AMF with an XmlDictionaryReader and returns the deserialized object; it also enables you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to deserialize.
Unable to resolve data contracts.
public ReadObject ( XmlDictionaryReader reader, bool verifyObjectName ) : object
reader System.Xml.XmlDictionaryReader An XmlDictionaryReader used to read the AMFX document mapped from AMF.
verifyObjectName bool true to check whether the enclosing XML element name and namespace /// correspond to the expected name and namespace; otherwise, false to skip the verification.
return object

ReadObject() public method

Reads the XML document mapped from AMFX (Action Message Format in XML) with an XmlReader and returns the deserialized object.
Unable to resolve data contracts.
public ReadObject ( XmlReader reader ) : object
reader XmlReader XML reader.
return object

ReadObject() public method

Reads the AMFX document mapped from AMF with an XmlReader and returns the deserialized object; it also enables you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to deserialize.
Unable to resolve data contracts.
public ReadObject ( XmlReader reader, bool verifyObjectName ) : object
reader XmlReader An XmlReader used to read the AMFX document mapped from AMF.
verifyObjectName bool true to check whether the enclosing XML element name and namespace /// correspond to the expected name and namespace; otherwise, false to skip the verification.
return object

ReadObject() public method

Reads a document stream in the AMF (Action Message Format) format and writes it in the AMFX (Action Message Format in XML) format,
Unable to resolve data contracts.
public ReadObject ( Stream stream, XmlWriter output ) : void
stream Stream The Stream to be read.
output System.Xml.XmlWriter AMFX writer.
return void

WriteEndObject() public method

public WriteEndObject ( XmlDictionaryWriter writer ) : void
writer System.Xml.XmlDictionaryWriter
return void

WriteEndObject() public method

public WriteEndObject ( XmlWriter writer ) : void
writer System.Xml.XmlWriter
return void

WriteObject() public method

Reads a specified Action Message Format in XML (AMFX) data and writes the resulting AMF data to a stream.
Unable to resolve data contracts. Error during encoding.
public WriteObject ( Stream stream, XmlReader input ) : void
stream Stream The Stream to be written.
input XmlReader AMFX reader.
return void

WriteObject() public method

Serializes a specified object to Action Message Format (AMF) data and writes the resulting AMF to a stream.
Unable to resolve data contracts. Error during encoding.
public WriteObject ( Stream stream, object graph ) : void
stream Stream The Stream that is written to.
graph object The object that contains the data to write to the stream.
return void

WriteObject() public method

Serializes an object to XML that may be mapped to Action Message Format in XML (AMFX). Writes all the object data, including the starting XML element, content, and closing element, with an XmlWriter.
Unable to serialize data contracts.
public WriteObject ( XmlWriter writer, object graph ) : void
writer System.Xml.XmlWriter XML writer.
graph object Object graph.
return void

WriteObjectContent() public method

Writes the XML content that can be mapped to Action Message Format (AMF) using an XmlDictionaryWriter.
public WriteObjectContent ( XmlDictionaryWriter writer, object graph ) : void
writer System.Xml.XmlDictionaryWriter The XmlDictionaryWriter used to write to.
graph object The object to write.
return void

WriteObjectContent() public method

Writes the XML content that can be mapped to Action Message Format (AMF) using an XmlWriter.
public WriteObjectContent ( XmlWriter writer, object graph ) : void
writer System.Xml.XmlWriter The XmlWriter used to write to.
graph object The object to write.
return void

WriteStartObject() public method

public WriteStartObject ( XmlDictionaryWriter writer, object graph ) : void
writer System.Xml.XmlDictionaryWriter
graph object
return void

WriteStartObject() public method

public WriteStartObject ( XmlWriter writer, object graph ) : void
writer System.Xml.XmlWriter
graph object
return void