Here you can find the source of load(File file, Properties data)
file
.
Parameter | Description |
---|---|
file | the file to load (quiet if <b>null</b> or file does not exist) |
data | the data read |
Parameter | Description |
---|---|
IOException | in case of I/O problems |
public static void load(File file, Properties data) throws IOException
//package com.java2s; /*/* www. j av a 2 s .c om*/ * Copyright 2009-2016 University of Hildesheim, Software Systems Engineering * * 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.File; import java.io.FileReader; import java.io.IOException; import java.util.Properties; public class Main { /** * Loads a properties file from <code>file</code>. * * @param file the file to load (quiet if <b>null</b> or file does not exist) * @param data the data read * @throws IOException in case of I/O problems */ public static void load(File file, Properties data) throws IOException { if (null != file && file.exists()) { FileReader fr = null; try { fr = new FileReader(file); data.load(fr); } finally { if (null != fr) { fr.close(); } } } } }