Here you can find the source of load(Path p, PrintStream errorStream, String propertyInfo)
public static Properties load(Path p, PrintStream errorStream, String propertyInfo)
//package com.java2s; /*/*from w ww. ja v a2 s. c o m*/ * Copyright (c) 2008 Kasper Nielsen. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.nio.file.Path; import java.util.Properties; public class Main { public static Properties load(Path p, PrintStream errorStream, String propertyInfo) { try { FileInputStream fis = new FileInputStream(p.toFile()); return loadAndClose(fis, errorStream, propertyInfo); } catch (FileNotFoundException e) { errorStream.println("Could not find property file " + propertyInfo); return new Properties(); } } public static Properties loadAndClose(InputStream inputStream, PrintStream errorStream, String propertyInfo) { try { Properties properties = new Properties(); properties.load(inputStream); try { inputStream.close(); } catch (IOException e) { errorStream.println( "Could not close property file properly " + propertyInfo + ", failure = " + e.getMessage()); } return properties; } catch (IOException e) { errorStream.println("Could not load property file " + propertyInfo + ", failure = " + e.getMessage()); } return new Properties();// Failed return a completely empty Properties } }