Пример #1
0
        /// <summary>
        /// 从Position偏移位置读取2个字节
        /// 返回其Int16表示类型
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <returns></returns>
        public short ReadInt16()
        {
            var value = ByteConverter.ToInt16(this._buffer, this.Position, this.Endian);

            this.Position = this.Position + sizeof(short);
            return(value);
        }
Пример #2
0
 /// <summary>
 /// 读取指定位置2个字节,返回其Int16表示类型
 /// </summary>
 /// <param name="index">字节所在索引</param>
 /// <param name="littleEndian">是否低位在前</param>
 /// <returns></returns>
 public int ToInt16(int index, bool littleEndian)
 {
     return(ByteConverter.ToInt16(this.Source, index, littleEndian));
 }
Пример #3
0
        /// <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));
        }
Пример #4
0
 /// <summary>
 /// 读取指定位置2个字节,返回其Int16表示类型
 /// </summary>
 /// <param name="index">字节所在索引</param>
 /// <param name="endian">高低位</param>
 /// <returns></returns>
 public int ToInt16(int index, Endians endian)
 {
     return(ByteConverter.ToInt16(this.Source, index, endian));
 }