Пример #1
0
 public static System.Object deserialize(sbyte[] data, ExternalizableWrapper ew)
 {
     System.IO.MemoryStream bais = new System.IO.MemoryStream((byte[])(Array)data);
     try
     {
         return(read(new System.IO.BinaryReader(bais), ew));
     }
     catch (System.IO.EndOfStreamException eofe)
     {
         throw new DeserializationException("Unexpectedly reached end of stream when deserializing");
     }
     catch (System.IO.IOException udfe)
     {
         throw new DeserializationException("Unexpectedly reached end of stream when deserializing");
     }
     finally
     {
         try
         {
             bais.Close();
         }
         catch (System.IO.IOException e)
         {
             //already closed. Don't sweat it
         }
     }
 }
Пример #2
0
 public static System.Object deserialize(sbyte[] data, ExternalizableWrapper ew)
 {
     System.IO.MemoryStream bais = new System.IO.MemoryStream(SupportClass.ToByteArray(data));
     try
     {
         return(read(new System.IO.BinaryReader(bais), ew));
     }
     catch (System.IO.EndOfStreamException eofe)
     {
         throw new DeserializationException("Unexpectedly reached end of stream when deserializing");
     }
     catch (System.IO.IOException udfe)
     {
         throw new DeserializationException("Unexpectedly reached end of stream when deserializing");
     }
     catch (System.IO.IOException e)
     {
         throw new System.SystemException("Unknown IOException reading from ByteArrayInputStream; shouldn't happen!");
     }
     finally
     {
         try
         {
             bais.Close();
         }
         catch (System.IO.IOException e)
         {
             //already closed. Don't sweat it
         }
     }
 }
Пример #3
0
        public ExtWrapList(ExternalizableWrapper type)
        {
            if (type == null)
            {
                throw new System.NullReferenceException();
            }

            this.type           = type;
            this.sealed_Renamed = false;
        }
Пример #4
0
        public ExtWrapMapPoly(ExternalizableWrapper keyType, bool ordered)
        {
            if (keyType == null)
            {
                throw new System.NullReferenceException();
            }

            this.keyType = keyType;
            this.ordered = ordered;
        }
Пример #5
0
        public ExtWrapMap(ExternalizableWrapper keyType, ExternalizableWrapper dataType, int type)
        {
            if (keyType == null || dataType == null)
            {
                throw new System.NullReferenceException();
            }

            this.keyType  = keyType;
            this.dataType = dataType;
            this.type     = type;
        }
Пример #6
0
        public ExtWrapList(System.Collections.ArrayList val, ExternalizableWrapper type)
        {
            if (val == null)
            {
                throw new System.NullReferenceException();
            }

            this.val            = val;
            this.type           = type;
            this.sealed_Renamed = false;
        }
Пример #7
0
        public ExtWrapList(List <SelectChoice> val, ExternalizableWrapper type)
        {
            if (val == null)
            {
                throw new System.NullReferenceException();
            }

            this.val            = val;
            this.type           = type;
            this.sealed_Renamed = false;
        }
Пример #8
0
        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public ExtWrapMapPoly(System.Collections.Hashtable val, ExternalizableWrapper keyType)
        {
            if (val == null)
            {
                throw new System.NullReferenceException();
            }

            this.val     = val;
            this.keyType = keyType;
            this.ordered = (val is OrderedMap);
        }
Пример #9
0
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public static ExternalizableWrapper readTag(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            sbyte[] tag = new sbyte[PrototypeFactory.CLASS_HASH_SIZE];

            in_Renamed.Read((byte[])(Array)tag, 0, tag.Length);



            if (PrototypeFactory.compareHash(tag, WRAPPER_TAG))
            {
                int wrapperCode = ExtUtil.readInt(in_Renamed);

                //find wrapper indicated by code
                ExternalizableWrapper type = null;

                foreach (Object key in WRAPPER_CODES.Keys)
                {
                    System.Type t = (System.Type)key;
                    if ((int)WRAPPER_CODES[key] == wrapperCode)
                    {
                        try
                        {
                            type = (ExternalizableWrapper)PrototypeFactory.getInstance(t);
                        }
                        catch (CannotCreateObjectException ccoe)
                        {
                            //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                            throw new CannotCreateObjectException("Serious problem: cannot create built-in ExternalizableWrapper [" + t.FullName + "]");
                        }
                    }
                }
                if (type == null)
                {
                    throw new DeserializationException("Unrecognized ExternalizableWrapper type [" + wrapperCode + "]");
                }

                type.metaReadExternal(in_Renamed, pf);
                return(type);
            }
            else
            {
                System.Type type = pf.getClass(tag);
                if (type == null)
                {
                    throw new DeserializationException("No datatype registered to serialization code " + ExtUtil.printBytes((byte[])(Array)tag));
                }

                return(new ExtWrapBase(type));
            }
        }
Пример #10
0
        /* serialization or deserialization, depending on context */

        public ExtWrapNullable(ExternalizableWrapper type)
        {
            if (type is ExtWrapNullable)
            {
                throw new System.ArgumentException("Wrapping nullable with nullable is redundant");
            }
            else if (type != null && type.Empty)
            {
                this.type = type;
            }
            else
            {
                this.val = type;
            }
        }
Пример #11
0
        public ExtWrapMap(System.Collections.IDictionary val, ExternalizableWrapper keyType, ExternalizableWrapper dataType)
        {
            if (val == null)
            {
                throw new System.NullReferenceException();
            }

            this.val      = val;
            this.keyType  = keyType;
            this.dataType = dataType;
            if (val is Map)
            {
                //TODO: check for sealed
                type = TYPE_SLOW_READ_ONLY;
            }
            else if (val is OrderedMap)
            {
                type = TYPE_ORDERED;
            }
            else
            {
                type = TYPE_NORMAL;
            }
        }
Пример #12
0
 public ExtWrapMapPoly(ExternalizableWrapper keyType) : this(keyType, false)
 {
 }
Пример #13
0
 public ExtWrapMap(System.Type keyType, ExternalizableWrapper dataType, int type)
     : this(new ExtWrapBase(keyType), dataType, type)
 {
 }
Пример #14
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public override void  metaReadExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     ordered = ExtUtil.readBool(in_Renamed);
     keyType = ExtWrapTagged.readTag(in_Renamed, pf);
 }
Пример #15
0
 //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
 public ExtWrapMap(System.Collections.Hashtable val, ExternalizableWrapper dataType)
     : this(val, null, dataType)
 {
 }
Пример #16
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public static System.Object read(System.IO.BinaryReader in_Renamed, ExternalizableWrapper ew)
 {
     return(read(in_Renamed, ew, null));
 }
Пример #17
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public static System.Object read(System.IO.BinaryReader in_Renamed, ExternalizableWrapper ew, PrototypeFactory pf)
 {
     ew.readExternal(in_Renamed, pf == null?defaultPrototypes():pf);
     return(ew.val);
 }
Пример #18
0
        //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
        public override void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
        {
            ExternalizableWrapper type = readTag(in_Renamed, pf);

            val = ExtUtil.read(in_Renamed, type, pf);
        }
Пример #19
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public override void metaReadExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     type = ExtWrapTagged.readTag(in_Renamed, pf);
 }
Пример #20
0
 public ExtWrapMap(ExternalizableWrapper keyType, ExternalizableWrapper dataType)
     : this(keyType, dataType, TYPE_NORMAL)
 {
 }
Пример #21
0
 public static Object read(BinaryReader in_r, ExternalizableWrapper ew, PrototypeFactory pf)
 {
     ew.readExternal(in_r, pf == null ? defaultPrototypes() : pf);
     return(ew.val);
 }
Пример #22
0
 public static Object read(BinaryReader in_r, ExternalizableWrapper ew)
 {
     return(read(in_r, ew, null));
 }
Пример #23
0
 public ExtWrapNullable(System.Type type)
 {
     this.type = new ExtWrapBase(type);
 }
Пример #24
0
 public ExtWrapList(System.Type type, bool sealed_Renamed)
 {
     this.type           = new ExtWrapBase(type);
     this.sealed_Renamed = sealed_Renamed;
 }