/** * Read properties from the specified InputStream. * * @param in * the stream to read from. The stream will be closed by this method. * @return Properties loaded from the specified stream. The stream will be * closed by this method. * @throws IOException * when the stream could not be read properly */ public static Properties readProperties(InputStream in) throws IOException { return readProperties(in, null); }
/** * Read properties from the specified file. * * @param propsFile * the file to read from * @return Properties loaded from the specified file * @throws IOException * when the file could not be read properly */ public static Properties readProperties(File propsFile) throws IOException { return readProperties(propsFile, null); }
/** * Read properties from the specified file. * * @param propsFile * the file to read from * @param defaults * the default properties to use * @return Properties loaded from the specified file * @throws IOException * when the file could not be read properly */ public static Properties readProperties(File propsFile, Properties defaults) throws IOException { return readProperties(new FileInputStream(propsFile), defaults); }
/** * Load configuration properties from the specified file. * * @param file * the file to load from * @return the contents of the file as Properties, or null if the file did * not exist * @throws IOException * if the contents of the file could not be read due to an I/O * problem */ public static Properties loadConfigurationProperties(File file, Properties defaults) throws IOException { Properties result = null; if (file.exists()) { result = IOUtil.readProperties(file, defaults); } else { result = new Properties(defaults); } return result; }
/** * Load configuration properties from the specified file. * * @param file * the file to load from * @return the contents of the file as Properties, or null if the file did * not exist * @throws IOException * if the contents of the file could not be read due to an I/O * problem */ public static Properties loadConfigurationProperties(File file, Properties defaults) throws IOException { Properties result = null; if (file.exists()) { result = IOUtil.readProperties(file, defaults); } else { result = new Properties(defaults); } return result; }
InputStream in = ResourceUtil.getInputStream(defaultResourceName); if (in != null) { defaultResult = IOUtil.readProperties(in, defaults); result = IOUtil.readProperties(in, defaultResult);
InputStream in = ResourceUtil.getInputStream(defaultResourceName); if (in != null) { defaultResult = IOUtil.readProperties(in, defaults); result = IOUtil.readProperties(in, defaultResult);