code: public static Properties propFileToProperties(String filename) {
      Properties result = new Properties();
      try {
        InputStream is = new BufferedInputStream(new FileInputStream(filename));
        result.load(is);
        // trim all values
        for (Object propKey : result.keySet()){
          String newVal = result.getProperty((String)propKey);
          result.setProperty((String)propKey,newVal.trim());
        }
        is.close();
        return result;
      } catch (IOException e) {
        throw new RuntimeIOException("propFileToProperties could not read properties file: " + filename, e);
      }
    }
docs: This method reads in properties listed in a file in the format prop=value, one property per line.
  Although <code>Properties.load(InputStream)</code> exists, I implemented this method to trim the lines,
  something not implemented in the <code>load()</code> method.
  @param filename A properties file to read
  @return The corresponding Properties object