コード例 #1
0
ファイル: ExtUtil.cs プロジェクト: ryanbehr/csrosa
 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
ファイル: ExtUtil.cs プロジェクト: amasasi/DotNetRosa
 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
ファイル: ExtWrapMapPoly.cs プロジェクト: amasasi/DotNetRosa
        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
ファイル: ExtWrapMapPoly.cs プロジェクト: amasasi/DotNetRosa
        //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
ファイル: ExtWrapTagged.cs プロジェクト: ryanbehr/csrosa
        //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
ファイル: ExtWrapNullable.cs プロジェクト: amasasi/DotNetRosa
        /* 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
ファイル: ExtWrapMapPoly.cs プロジェクト: amasasi/DotNetRosa
 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
ファイル: ExtWrapMapPoly.cs プロジェクト: amasasi/DotNetRosa
 //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
ファイル: ExtUtil.cs プロジェクト: amasasi/DotNetRosa
 //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
ファイル: ExtUtil.cs プロジェクト: amasasi/DotNetRosa
 //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
ファイル: ExtWrapTagged.cs プロジェクト: amasasi/DotNetRosa
        //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
ファイル: ExtUtil.cs プロジェクト: ryanbehr/csrosa
 public static Object read(BinaryReader in_r, ExternalizableWrapper ew, PrototypeFactory pf)
 {
     ew.readExternal(in_r, pf == null ? defaultPrototypes() : pf);
     return(ew.val);
 }
コード例 #22
0
ファイル: ExtUtil.cs プロジェクト: ryanbehr/csrosa
 public static Object read(BinaryReader in_r, ExternalizableWrapper ew)
 {
     return(read(in_r, ew, null));
 }
コード例 #23
0
ファイル: ExtWrapNullable.cs プロジェクト: amasasi/DotNetRosa
 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;
 }