Ejemplo n.º 1
0
        public Object ReadMap(AbstractHessianInput abstractHessianInput, Object obj)
        {
            try
            {
                int iref = abstractHessianInput.AddRef(obj);

                while (!abstractHessianInput.IsEnd())
                {
                    Object key = abstractHessianInput.ReadObject();

                    FieldDeserializer deser = (FieldDeserializer)_fieldMap[key];

                    if (deser != null)
                    {
                        deser.Deserialize(abstractHessianInput, obj);
                    }
                    else
                    {
                        abstractHessianInput.ReadObject();
                    }
                }

                abstractHessianInput.ReadMapEnd();

                Object resolve = Resolve(abstractHessianInput, obj);

                if (obj != resolve)
                {
                    abstractHessianInput.SetRef(iref, resolve);
                }

                return(resolve);
            }
            catch (IOException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new CHessianException(e.Message);
            }
        }
Ejemplo n.º 2
0
        public Object ReadObject(AbstractHessianInput abstractHessianInput, Object obj, string[] fieldNames)
        {
            try
            {
                int iref = abstractHessianInput.AddRef(obj);

                foreach (var fieldName in fieldNames)
                {
                    FieldDeserializer reader = (FieldDeserializer)_fieldMap[fieldName];

                    if (reader != null)
                    {
                        reader.Deserialize(abstractHessianInput, obj);
                    }
                    else
                    {
                        abstractHessianInput.ReadObject();
                    }
                }

                Object resolve = Resolve(abstractHessianInput, obj);

                if (obj != resolve)
                {
                    abstractHessianInput.SetRef(iref, resolve);
                }

                return(resolve);
            }
            catch (IOException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new CHessianException(obj.GetType().FullName + ":" + e, e);
            }
        }