/// <summary> /// Reads a float value from the stream in little endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public float ReadSingleLE() { return(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadSingle()) : ReadSingle()); }
/// <summary> /// Reads a double value from the stream in little endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public double ReadDoubleLE() { return(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadDouble()) : ReadDouble()); }
/// <summary> /// Reads an Int64 value from the stream in big endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public long ReadInt64BE() { return(BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadInt64()) : ReadInt64()); }
/// <summary> /// Reads a UInt64 value from the stream in little endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public ulong ReadUInt64LE() { return(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadUInt64()) : ReadUInt64()); }
/// <summary> /// Reads an Int32 value from the stream in big endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public int ReadInt32BE() { return(BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadInt32()) : ReadInt32()); }
/// <summary> /// Reads a UInt32 value from the stream in little endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public uint ReadUInt32LE() { return(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadUInt32()) : ReadUInt32()); }
/// <summary> /// Reads an Int16 value from the stream in big endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public short ReadInt16BE() { return(BitConverter.IsLittleEndian?ByteOrderUtility.Swap(ReadInt16()): ReadInt16()); }
/// <summary> /// Reads a UInt16 value from the stream in little endian byte order /// </summary> /// <returns>The value read</returns> /// <remarks>This throws if the data isn't available</remarks> public ushort ReadUInt16LE() { return(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(ReadUInt16()) : ReadUInt16()); }
/// <summary> /// Writes a signed 16-bit integer to the output stream in big-endian byte order /// </summary> /// <param name="value">The value to write</param> public void WriteInt16BE(short value) { WriteBytes(BitConverter.GetBytes(BitConverter.IsLittleEndian?ByteOrderUtility.Swap(value):value)); }
/// <summary> /// Writes a 64-bit floating point value to the output stream in little-endian byte order /// </summary> /// <param name="value">The value to write</param> public void WriteDoubleLE(double value) { WriteBytes(BitConverter.GetBytes(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(value) : value)); }
/// <summary> /// Writes a 32-bit floating point value to the output stream in big-endian byte order /// </summary> /// <param name="value">The value to write</param> public void WriteSingleBE(float value) { WriteBytes(BitConverter.GetBytes(BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(value) : value)); }
/// <summary> /// Writes a unsigned 64-bit integer to the output stream in little-endian byte order /// </summary> /// <param name="value">The value to write</param> public void WriteUInt64LE(ulong value) { WriteBytes(BitConverter.GetBytes(!BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(value) : value)); }
/// <summary> /// Writes a unsigned 32-bit integer to the output stream in big-endian byte order /// </summary> /// <param name="value">The value to write</param> public void WriteUInt32BE(uint value) { WriteBytes(BitConverter.GetBytes(BitConverter.IsLittleEndian ? ByteOrderUtility.Swap(value) : value)); }