コード例 #1
0
ファイル: NsStream.cs プロジェクト: WildGenie/NetworkSocket
        /// <summary>
        /// 从流中读取4个字节,并将流内的位置向前推进4个字节,
        /// 返回其UInt32表示类型
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <returns></returns>
        public uint ReadUInt32()
        {
            var range = this.ReadByteRange(sizeof(uint));

            return(ByteConverter.ToUInt32(range.Buffer, range.Offset, this.Endian));
        }
コード例 #2
0
ファイル: NsStream.cs プロジェクト: WildGenie/NetworkSocket
        /// <summary>
        /// 从流中读取8个字节,并将流内的位置向前推进8个字节,
        /// 返回其UInt64表示类型
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <returns></returns>
        public ulong ReadUInt64()
        {
            var range = this.ReadByteRange(sizeof(ulong));

            return(ByteConverter.ToUInt64(range.Buffer, range.Offset, this.Endian));
        }
コード例 #3
0
ファイル: NsStream.cs プロジェクト: WildGenie/NetworkSocket
        /// <summary>
        /// 从流中读取2个字节,并将流内的位置向前推进2个字节,
        /// 返回其Int16表示类型
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <returns></returns>
        public short ReadInt16()
        {
            var range = this.ReadByteRange(sizeof(short));

            return(ByteConverter.ToInt16(range.Buffer, range.Offset, this.Endian));
        }