public static bool ReadBool(IByteReader r)
        {
            uint val = XdrEncoding.DecodeUInt32(r);

            if (val == 0)
            {
                return(false);
            }
            if (val == 1)
            {
                return(true);
            }

            throw new InvalidOperationException("unexpected value: " + val.ToString());
        }
        private static uint CheckedReadLength(IByteReader r, uint max)
        {
            uint len;

            try
            {
                len = XdrEncoding.DecodeUInt32(r);
            }
            catch (SystemException ex)
            {
                throw new FormatException("cant't read 'length'", ex);
            }

            if (len > max)
            {
                throw new FormatException("unexpected length: " + len.ToString());
            }
            return(len);
        }