Java Properties Load from File load(File file)

Here you can find the source of load(File file)

Description

Loads the specified properties file into memory

License

MIT License

Parameter

Parameter Description
file the properties File to load

Exception

Parameter Description
FileNotFoundException if the specified File does not exist or is a directory
IOException if an error occurs while reading the File

Return

a based on the specified

Declaration

public static Properties load(File file) throws FileNotFoundException, IOException 

Method Source Code


//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;
    }
}

Related

  1. load(Class type, String resource, Properties map)
  2. load(Class cls)
  3. load(File f)
  4. load(File file)
  5. load(File file)
  6. load(File file)
  7. load(File file)
  8. load(File file, Properties data)
  9. load(File propertiesFile)