Example #1
0
        public static string ReadString(Stream stream)
        {
            string result;
            int    length = NetworkByteOrderConverter.ToInt32(stream);

            if (length < 0)
            {
                result = null;
            }
            else
            {
                byte[] buffer = new byte[length];
                stream.Read(buffer, 0, length);
                result = Encoding.UTF8.GetString(buffer);
            }
            return(result);
        }
Example #2
0
 public static int ReadInt32(Stream stream)
 {
     return(NetworkByteOrderConverter.ToInt32(stream));
 }