/// <summary> /// Reads a 2-byte unsigned integer from the current stream and advances the position of the stream by two bytes. /// </summary> /// <param name="asLittleEndian">true to read in little-endian format; otherwise, false.</param> /// <returns>A 2-byte unsigned integer read from this stream.</returns> public ushort ReadUInt16(bool asLittleEndian) => PrimitiveConverter.ToUInt16(ReadInt16(asLittleEndian));
/// <summary> /// Reads a signed byte from this stream and advances the current position of the stream by one byte. /// </summary> /// <returns>A signed byte read from the current stream.</returns> public sbyte ReadSByte() => PrimitiveConverter.ToSByte(ReadByte());
/// <summary> /// Reads an 8-byte unsigned integer from the current stream and advances the position of the stream by eight bytes. /// </summary> /// <param name="asLittleEndian">true to read in little-endian format; otherwise, false.</param> /// <returns>An 8-byte unsigned integer read from this stream.</returns> public ulong ReadUInt64(bool asLittleEndian) => PrimitiveConverter.ToUInt64(ReadInt64(asLittleEndian));
/// <summary> /// Reads a 4-byte unsigned integer from the current stream and advances the position of the stream by four bytes. /// </summary> /// <param name="asLittleEndian">true to read in little-endian format; otherwise, false.</param> /// <returns>A 4-byte unsigned integer read from this stream.</returns> public uint ReadUInt32(bool asLittleEndian) => PrimitiveConverter.ToUInt32(ReadInt32(asLittleEndian));
/// <summary> /// Reads an 4-byte floating point value from the current stream and advances the current position of the stream by four bytes. /// </summary> /// <param name="asLittleEndian">true to read in little-endian format; otherwise, false.</param> /// <returns>An 4-byte floating point value read from the current stream.</returns> public float ReadSingle(bool asLittleEndian) => PrimitiveConverter.ToSingle(ReadInt32(asLittleEndian));
/// <summary> /// Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes. /// </summary> /// <param name="asLittleEndian">true to read in little-endian format; otherwise, false.</param> /// <returns>An 8-byte floating point value read from the current stream.</returns> public double ReadDouble(bool asLittleEndian) => PrimitiveConverter.ToDouble(ReadInt64(asLittleEndian));
/// <summary> /// Writes an signed byte to the current buffer and advances the buffer position by one byte. /// </summary> /// <param name="value">The signed byte to write.</param> public void Write(sbyte value) => Write(PrimitiveConverter.ToByte(value));
/// <summary> /// Writes an eight-byte unsigned integer to the current buffer and advances the buffer position by eight bytes. /// </summary> /// <param name="value">The eight-byte unsigned integer to write.</param> /// <param name="asLittleEndian">true to write in little-endian format; otherwise, false.</param> public void Write(ulong value, bool asLittleEndian) => Write(PrimitiveConverter.ToInt64(value), asLittleEndian);
/// <summary> /// Writes a four-byte unsigned integer to the current buffer and advances the buffer position by four bytes. /// </summary> /// <param name="value">The four-byte unsigned integer to write.</param> /// <param name="asLittleEndian">true to write in little-endian format; otherwise, false.</param> public void Write(uint value, bool asLittleEndian) => Write(PrimitiveConverter.ToInt32(value), asLittleEndian);