예제 #1
0
        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));
        }
예제 #2
0
        public static Byte[] ReadByteArray(this ObjectReader reader)
        {
            var length = reader.ReadInt32();

            return(reader.ReadBuffer(length));
        }