public static long ReadInt64(Stream stream) { using (var r = new BinReader(stream)) { return r.ReadInt64(); } }
/// <summary> /// Read an object in type_id/value format. /// </summary> /// <param name="inStream"></param> /// <returns></returns> public static Object getObject(Stream inStream) { using (BinReader r = new BinReader(inStream)) { int type = r.ReadInt32(); switch (type) { case TYPE_INT32: return r.ReadInt32(); case TYPE_INT64: return r.ReadInt64(); case TYPE_REAL64: return r.ReadDouble(); case TYPE_STRING: return getString(inStream); case TYPE_OPAQUE: return getBytes(inStream); default: throw new ProtocolCodecException("Unknown type code: " + type); } } }
/// <summary> /// Read a length-demlimited array of longs. /// </summary> /// <param name="inStream"></param> /// <returns></returns> public static long[] getLongArray(Stream inStream) { long[] longs = new long[getPositiveInt(inStream)]; using (BinReader r = new BinReader(inStream)) { for (int i = 0; i < longs.Length; i++) longs[i] = r.ReadInt64(); } return longs; }