public static string ReadString(this ObjectReader reader) { var byteLength = reader.ReadInt32(); if (byteLength == -1) { return(null); } else if (byteLength == 0) { return(string.Empty); } var bytes = reader.ReadBuffer(byteLength); return(reader.Encoding.GetString(bytes)); }
public static Byte[] ReadByteArray(this ObjectReader reader) { var length = reader.ReadInt32(); return(reader.ReadBuffer(length)); }