22  private static final int MAX_ERRORS = 20;
 
   23  private static final int MAX_LINES = 500;
 
   25  private HashMap<String, Object> options;
 
   40    options = 
new HashMap<>();
 
   43  public void parse(String filename) 
throws IOException
 
   45    BufferedReader br = 
new BufferedReader(
new FileReader(filename));
 
   52    while ((line = br.readLine()) != 
null)
 
   57      if (errors > MAX_ERRORS || lines > MAX_LINES)
 
   60        throw new IOException(
"Parsing limits exceeded");
 
   63      String[] fields = line.split(
":", 3);
 
   65      if (fields.length == 3)
 
   67        if (fields[1].equals(
"s"))
 
   69          options.put(fields[0].toLowerCase(Locale.ENGLISH), fields[2]);
 
   72        else if (fields[1].equals(
"i"))
 
   76            Integer i = Integer.parseInt(fields[2]);
 
   77            options.put(fields[0].toLowerCase(Locale.ENGLISH), i);
 
   80          catch (NumberFormatException e)
 
   84        else if (fields[1].equals(
"b"))
 
   96  public String getString(String optionName)
 
   98    if (options.get(optionName) instanceof String)
 
   99      return (String)options.get(optionName);
 
  104  public Integer getInteger(String optionName)
 
  106    if (options.get(optionName) instanceof Integer)
 
  107      return (Integer)options.get(optionName);