示例#1
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, System.Type type, PrototypeFactory pf)
 {
     if (typeof(Externalizable).IsAssignableFrom(type))
     {
         Externalizable ext = (Externalizable)PrototypeFactory.getInstance(type);
         ext.readExternal(in_Renamed, pf == null?defaultPrototypes():pf);
         return(ext);
     }
     else if (type == typeof(System.SByte))
     {
         return((sbyte)readByte(in_Renamed));
     }
     else if (type == typeof(System.Int16))
     {
         return((short)readShort(in_Renamed));
     }
     else if (type == typeof(System.Int32))
     {
         return((System.Int32)readInt(in_Renamed));
     }
     else if (type == typeof(System.Int64))
     {
         return((long)readNumeric(in_Renamed));
     }
     else if (type == typeof(System.Char))
     {
         return(readChar(in_Renamed));
     }
     else if (type == typeof(System.Single))
     {
         //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
         return((float)readDecimal(in_Renamed));
     }
     else if (type == typeof(System.Double))
     {
         return((double)readDecimal(in_Renamed));
     }
     else if (type == typeof(System.Boolean))
     {
         return(readBool(in_Renamed));
     }
     else if (type == typeof(System.String))
     {
         return(readString(in_Renamed));
     }
     else if (type == typeof(System.DateTime))
     {
         return(readDate(in_Renamed));
     }
     else if (type == typeof(sbyte[]))
     {
         return(readBytes(in_Renamed));
     }
     else
     {
         //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 System.InvalidCastException("Not a deserializable datatype: " + type.FullName);
     }
 }
示例#2
0
 //**REMOVE THESE TWO FUNCTIONS//
 //original deserialization API (whose limits made us make this whole new framework!); here for backwards compatibility
 public static void  deserialize(sbyte[] data, Externalizable ext)
 {
     ext.readExternal(new System.IO.BinaryReader(new System.IO.MemoryStream(SupportClass.ToByteArray(data))), defaultPrototypes());
 }