public Type ReadClass()
        {
            int type = ReadByte();

            if (type == BinaryObjectEncoder.OBJECT_TYPE_NULL)
            {
                return(null);
            }
            else if (type == BinaryObjectEncoder.OBJECT_TYPE_ARRAY)
            {
                Type componentClass = ReadClass();
                return(componentClass.MakeArrayType());
            }
            else if (type == BinaryObjectEncoder.OBJECT_TYPE_CLASS)
            {
                String           typeName = ReadString(true);
                ObjectTypeMapper mapper   =
                    ObjectSerializerRegistry.GetMapperBySerialType(typeName);
                if (mapper == null)
                {
                    throw new ConnectorException("No deserializer for type: " + typeName);
                }
                return(mapper.HandledObjectType);
            }
            else
            {
                throw new ConnectorException("Bad type value: " + type);
            }
        }
예제 #2
0
 private Type DecodeClass(String type)
 {
     if (type.EndsWith("[]"))
     {
         String componentName  = type.Substring(0, type.Length - "[]".Length);
         Type   componentClass =
             DecodeClass(componentName);
         Type arrayClass =
             componentClass.MakeArrayType();
         return(arrayClass);
     }
     else
     {
         ObjectTypeMapper mapper =
             ObjectSerializerRegistry.GetMapperBySerialType(type);
         if (mapper == null)
         {
             throw new ConnectorException("No deserializer for type: " + type);
         }
         Type clazz = mapper.HandledObjectType;
         return(clazz);
     }
 }