Here you can find the source of readFile(String path, Properties store)
Parameter | Description |
---|---|
path | Path to the file. |
store | Properties object to store the data. |
Parameter | Description |
---|---|
IOException | If the method failes to load the properties, an IOException will be thrown. |
NullPointerException | If path or store are null, a NullPointerException will be thrown. |
public static void readFile(String path, Properties store) throws IOException
//package com.java2s; /*//w w w . ja v a 2s. co m * Copyright 2007-2009 Alexander Fabisch * * 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.*; import java.util.Properties; public class Main { /** * Reads data from a properties file to a Properties object. * * @param path * Path to the file. * @param store * Properties object to store the data. * @throws IOException * If the method failes to load the properties, an IOException will be thrown. * @throws NullPointerException * If path or store are null, a NullPointerException will be thrown. */ public static void readFile(String path, Properties store) throws IOException { checkNullReference(path, store); store.load(new FileInputStream(path)); } private static void checkNullReference(Object... objects) { for (Object o : objects) { if (o == null) { throw new NullPointerException("objects must not be null"); } } } }