Here you can find the source of load(File file)
Parameter | Description |
---|---|
file | the properties File to load |
Parameter | Description |
---|---|
FileNotFoundException | if the specified File does not exist or is a directory |
IOException | if an error occurs while reading the File |
public static Properties load(File file) throws FileNotFoundException, IOException
//package com.java2s; /*/* www . ja v a 2 s . c o m*/ * Strongback * Copyright 2015, Strongback and individual contributors by the @authors tag. * See the COPYRIGHT.txt in the distribution for a full listing of individual * contributors. * * Licensed under the MIT License; you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT * 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.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Properties; public class Main { /** * Loads the specified properties file into memory * @param file the properties {@link File} to load * @return a {@link Properties} based on the specified {@link File} * @throws FileNotFoundException if the specified {@link File} does not exist or is a directory * @throws IOException if an error occurs while reading the {@link File} */ public static Properties load(File file) throws FileNotFoundException, IOException { Properties props = new Properties(); props.load(new FileReader(file)); return props; } }