GSF.IO.BinaryStreamBase.ReadInt32 C# (CSharp) Method

ReadInt32() public method

Reads from the underlying stream in little endian format. Advancing the position.
public ReadInt32 ( ) : int
return int
        public virtual int ReadInt32()
        {
            ReadAll(m_buffer, 0, 4);
            return (int)m_buffer[0]
                | (int)m_buffer[1] << 8
                | (int)m_buffer[2] << 16
                | (int)m_buffer[3] << 24;
        }
        /// <summary>

Usage Example

 /// <summary>
 /// Reads the header data.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="treeNodeType"></param>
 /// <param name="blockSize"></param>
 internal static void ReadHeader(BinaryStreamBase stream, out EncodingDefinition treeNodeType, out int blockSize)
 {
     stream.Position = 0;
     byte version = stream.ReadUInt8();
     if (version == 109)
     {
         stream.Position = 0;
         stream.ReadGuid();
         treeNodeType = new EncodingDefinition(stream.ReadGuid());
         blockSize = stream.ReadInt32();
     }
     else if (version == 1)
     {
         blockSize = stream.ReadInt32();
         treeNodeType = new EncodingDefinition(stream);
     }
     else
     {
         throw new VersionNotFoundException();
     }
 }
All Usage Examples Of GSF.IO.BinaryStreamBase::ReadInt32