//public static TimeSpan ReadDiffTimeMcsAsTimeSpan(Stream stream) //{ // var microseconds = ReadDiffTimeMcs(stream); // var ticks = (long)microseconds * 10; // return new TimeSpan( ticks ); //} public static string ReadString(Stream stream) { var sz = LEB128.ReadULEB128(stream); const long MAX_STR = 128 * 1024; if (sz > MAX_STR) { throw new FinancialException(StringConsts.SECDB_STREAM_CORRUPTED_ERROR + "ReadString(): sz={0}>max={1}".Args(sz, MAX_STR)); } var buf = new byte[sz]; readFromStream(stream, buf, (int)sz); return(Encoding.UTF8.GetString(buf)); }
//public static ulong ReadTimestampMcs(Stream stream) //{ // var microseconds = ReadUInt64(stream); // return microseconds; //} //public static DateTime ReadTimestampMcsAsDateTime(Stream stream) //{ // var microseconds = ReadUInt64(stream); // return MiscUtils.FromMicrosecondsSinceUnixEpochStart( microseconds ); //} public static ulong ReadDiffTimeMcs(Stream stream) { var microseconds = LEB128.ReadULEB128(stream); return(microseconds); }
public static ulong ReadULEB128(Stream stream) { return(LEB128.ReadULEB128(stream)); }