/** * Loads a {@link Map} from a {@link File} assuming strings as keys * and values. * * @param file the {@link File} containing a {@link Properties}-like * layout of keys and values. * @return the read data as a {@link Map}. * @throws IOException if the file reader throws {@link IOException}. */ public static Map<String, String> load( File file ) throws IOException { FileInputStream stream = null; try { stream = new FileInputStream( file ); return load( stream ); } finally { closeIfNotNull( stream ); } }
/** * Stores the data in {@code config} into {@code file} in a standard java * {@link Properties} format. * @param config the data to store in the properties file. * @param file the file to store the properties in. * @throws IOException IO error. */ public static void store( Map<String, String> config, File file ) throws IOException { OutputStream stream = null; try { stream = new BufferedOutputStream( new FileOutputStream( file ) ); store( config, stream ); } finally { closeIfNotNull( stream ); } }
/** * Stores the data in {@code config} into {@code file} in a standard java * {@link Properties} format. * @param config the data to store in the properties file. * @param file the file to store the properties in. * @throws IOException IO error. */ public static void store( Map<String, String> config, File file ) throws IOException { OutputStream stream = null; try { stream = new BufferedOutputStream( new FileOutputStream( file ) ); store( config, stream ); } finally { closeIfNotNull( stream ); } }
/** * Loads a {@link Map} from a {@link File} assuming strings as keys * and values. * * @param file the {@link File} containing a {@link Properties}-like * layout of keys and values. * @return the read data as a {@link Map}. * @throws IOException if the file reader throws {@link IOException}. */ public static Map<String, String> load( File file ) throws IOException { FileInputStream stream = null; try { stream = new FileInputStream( file ); return load( stream ); } finally { closeIfNotNull( stream ); } }