Here you can find the source of loadConf()
@SuppressWarnings("resource") private static void loadConf() throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.HashMap; import java.util.Scanner; public class Main { private static final String confPath = "conf/weibo.conf"; private static HashMap<String, String> conf = null; @SuppressWarnings("resource") private static void loadConf() throws Exception { if (conf == null) conf = new HashMap<String, String>(); File file = new File(confPath); Scanner reader = new Scanner(file); while (reader.hasNextLine()) { String line = reader.nextLine().trim(); if (line.length() == 0) continue; if (line.startsWith("#")) continue; if (!line.contains(":")) throw new Exception("Invalid configuration: " + line); int pos = line.indexOf(':'); String key = line.substring(0, pos).trim(); String value = line.substring(pos + 1).trim(); conf.put(key, value);/* w w w .java 2s . c o m*/ } return; } }