public override FTable read(FStore.Input input) { if (input == null) { m_size = 0; return(this); } m_size = input.u2(); m_table = new object[m_size]; for (int i = 0; i < m_size; i++) { m_table[i] = FanDecimal.fromStr(input.utf(), true); } return(this); }
////////////////////////////////////////////////////////////////////////// // Write ////////////////////////////////////////////////////////////////////////// public void writeObj(object obj) { if (obj == null) { w("null"); return; } if (obj.GetType().FullName[0] == 'S') { if (obj is bool && (bool)obj) { w("true"); return; } if (obj is bool && !(bool)obj) { w("false"); return; } if (obj is double) { FanFloat.encode((double)obj, this); return; } if (obj is long) { FanInt.encode((long)obj, this); return; } if (obj is string) { wStrLiteral(obj.ToString(), '"'); return; } } if (obj.GetType().FullName[0] == 'F') { if (obj is Boolean && (obj as Boolean).booleanValue()) { w("true"); return; } if (obj is Boolean && !(obj as Boolean).booleanValue()) { w("false"); return; } if (obj is Double) { FanFloat.encode((obj as Double).doubleValue(), this); return; } if (obj is Long) { FanInt.encode((obj as Long).longValue(), this); return; } if (obj is BigDecimal) { FanDecimal.encode((BigDecimal)obj, this); return; } } if (obj is Literal) { ((Literal)obj).encode(this); return; } Type type = FanObj.@typeof(obj); Serializable ser = (Serializable)type.facet(Sys.SerializableType, false); if (ser != null) { if (ser.m_simple) { writeSimple(type, obj); } else { writeComplex(type, obj, ser); } } else { if (skipErrors) { w("null /* Not serializable: ").w(type.qname()).w(" */"); } else { throw IOErr.make("Not serializable: " + type).val; } } }