/// <summary> /// Writes the next object to the stream. /// </summary> /// <param name="object">The object to write.</param> /// <seealso cref="Org.IdentityConnectors.Framework.Common.Serializer.ObjectSerializerFactory" /> /// <exception cref="Org.IdentityConnectors.Framework.Common.Exceptions.ConnectorException">if there is more than one object /// and this is not configured for multi-object document.</exception> public void WriteObject(Object obj) { if (_documentEnded) { throw new InvalidOperationException("Attempt to writeObject after the document is already closed"); } StringBuilder buf = new StringBuilder(); XmlObjectEncoder encoder = new XmlObjectEncoder(buf); String elementName = encoder.WriteObject(obj); if (!_firstObjectWritten) { StartDocument(elementName); } else { if (!_multiObject) { throw new InvalidOperationException("Attempt to write multiple objects on a single-object document"); } } Write(buf.ToString()); _firstObjectWritten = true; }
/// <summary> /// Writes the next object to the stream. /// </summary> /// <param name="object">The object to write.</param> /// <seealso cref="Org.IdentityConnectors.Framework.Common.Serializer.ObjectSerializerFactory" /> /// <exception cref="Org.IdentityConnectors.Framework.Common.Exceptions.ConnectorException">if there is more than one object /// and this is not configured for multi-object document.</exception> public void WriteObject(Object obj) { if (_documentEnded) { throw new InvalidOperationException("Attempt to writeObject after the document is already closed"); } StringBuilder buf = new StringBuilder(); XmlObjectEncoder encoder = new XmlObjectEncoder(buf); String elementName = encoder.WriteObject(obj); if (!_firstObjectWritten) { StartDocument(elementName); } else { if (!_multiObject) { throw new InvalidOperationException("Attempt to write multiple objects on a single-object document"); } } Write(buf.ToString()); _firstObjectWritten = true; }
public long ReadLongField(String fieldName, long dflt) { return(DecodeLong(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeLong(dflt)))); }
public int ReadIntField(String fieldName, int dflt) { return(DecodeInt(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeInt(dflt)))); }
public float ReadFloatField(String fieldName, float dflt) { return(DecodeFloat(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeFloat(dflt)))); }
public double ReadDoubleField(String fieldName, double dflt) { return(DecodeDouble(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeDouble(dflt)))); }
public bool ReadBooleanField(String fieldName, bool dflt) { return(DecodeBoolean(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeBoolean(dflt)))); }