Here you can find the source of loadProperties(File file)
public static Properties loadProperties(File file)
//package com.java2s; /*/* w w w.j a va 2s . c o m*/ * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2005-2010, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Properties; public class Main { /** * Load {@link Properties} from a {@link File}. */ public static Properties loadProperties(File file) { try { InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(file)); Properties properties = new Properties(); properties.load(input); return properties; } finally { if (input != null) { input.close(); } } } catch (Exception e) { throw new RuntimeException(e); } } }