/// <summary>
 /// Reads a BSON Int32 from the reader.
 /// </summary>
 /// <returns>An Int32.</returns>
 public override int ReadInt32()
 {
     if (disposed)
     {
         ThrowObjectDisposedException();
     }
     VerifyBsonType("ReadInt32", BsonType.Int32);
     state = GetNextState();
     return(buffer.ReadInt32());
 }
 // internal methods
 internal virtual void ReadHeaderFrom(BsonBuffer buffer)
 {
     _messageLength = buffer.ReadInt32();
     _requestId = buffer.ReadInt32();
     _responseTo = buffer.ReadInt32();
     if ((MessageOpcode)buffer.ReadInt32() != _opcode)
     {
         throw new FileFormatException("Message header opcode is not the expected one.");
     }
 }
 // protected methods
 protected void ReadMessageHeaderFrom(BsonBuffer buffer)
 {
     messageLength = buffer.ReadInt32();
     requestId = buffer.ReadInt32();
     responseTo = buffer.ReadInt32();
     if ((MessageOpcode)buffer.ReadInt32() != opcode)
     {
         throw new FileFormatException("Message header opcode is not the expected one.");
     }
 }