예제 #1
0
        /// <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;
 }
예제 #3
0
 public long ReadLongField(String fieldName, long dflt)
 {
     return(DecodeLong(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeLong(dflt))));
 }
예제 #4
0
 public int ReadIntField(String fieldName, int dflt)
 {
     return(DecodeInt(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeInt(dflt))));
 }
예제 #5
0
 public float ReadFloatField(String fieldName, float dflt)
 {
     return(DecodeFloat(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeFloat(dflt))));
 }
예제 #6
0
 public double ReadDoubleField(String fieldName, double dflt)
 {
     return(DecodeDouble(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeDouble(dflt))));
 }
예제 #7
0
 public bool ReadBooleanField(String fieldName, bool dflt)
 {
     return(DecodeBoolean(ReadStringAttributeInternal(fieldName, XmlObjectEncoder.EncodeBoolean(dflt))));
 }