Here you can find the source of load(String filename)
public static Map<String, String> load(String filename)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Main { public static Map<String, String> load(String filename) { if (!filename.endsWith("properties")) filename += ".properties"; InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename); return load(is); }//from ww w .j a v a2s . co m public static Map<String, String> load(File properties) { try { return load(new FileInputStream(properties)); } catch (Exception e) { throw new IllegalStateException(e); } } public static Map<String, String> load(InputStream is) { try { Properties prop = new Properties(); prop.load(new InputStreamReader(is, "UTF-8")); Map<String, String> map = new HashMap<String, String>(prop.size(), 1.0f); for (Object k : prop.keySet()) { Object v = prop.get(k); String key = String.valueOf(k), value = String.valueOf(v); map.put(key, value); } return map; } catch (Exception e) { throw new IllegalStateException(e); } finally { if (is != null) try { is.close(); } catch (Exception ignore) { } } } }