@Test public void testReadProperty() { Properties props = FileUtil.readProperty(new File("src/test/resources/test.properties")); Assert.assertEquals(2, props.size()); Assert.assertEquals("test", props.get("run.environment")); Assert.assertEquals("true", props.get("application.mode.debug")); }
public static Properties readProperty(File f) { Properties properties = new Properties(); FileInputStream fis = null; try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); } fis = new FileInputStream(f); properties.load(fis); } catch (IOException e) { _log.error("Failed to load properties ["+f.getAbsolutePath()+"]", e); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } } return properties; }
FileUtil { public static Properties readProperty(File f) { Properties properties = new Properties(); FileInputStream fis = null; try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); } fis = new FileInputStream(f); properties.load(fis); } catch (IOException e) { _log.error("Failed to load properties ["+f.getAbsolutePath()+"]", e); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } } return properties; } }
FileUtil { public static Properties readProperty(File f) { Properties properties = new Properties(); FileInputStream fis = null; try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); } fis = new FileInputStream(f); properties.load(fis); } catch (IOException e) { _log.error("Failed to load properties ["+f.getAbsolutePath()+"]", e); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } } return properties; } private  FileUtil(); }
FileUtil { public static Properties readProperty(File f) { Properties properties = new Properties(); FileInputStream fis = null; try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); } fis = new FileInputStream(f); properties.load(fis); } catch (IOException e) { _log.error("Failed to load properties ["+f.getAbsolutePath()+"]", e); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } } return properties; } private  FileUtil(); static String readFile(File file); static String readFile(String filename); static byte[] readFileAsBytes(File file); static byte[] readFileAsBytes(String filename); static String backupFile(File source); static InputStream getFileStream(String name); static void writeFile(String filename, String content); static void appendFile(String filename, String content); static File createDirectory(String path); static boolean copyMultipartFile(final MultipartFile multipartFile,
			File dest); static Properties readProperty(File f); static void saveProperty(String filename, Properties properties, String header); static String getFilename(String filepath); }
FileUtil { public static Properties readProperty(File f) { Properties properties = new Properties(); FileInputStream fis = null; try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); } fis = new FileInputStream(f); properties.load(fis); } catch (IOException e) { _log.error("Failed to load properties ["+f.getAbsolutePath()+"]", e); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } } return properties; } private  FileUtil(); static String readFile(File file); static String readFile(String filename); static byte[] readFileAsBytes(File file); static byte[] readFileAsBytes(String filename); static String backupFile(File source); static InputStream getFileStream(String name); static void writeFile(String filename, String content); static void appendFile(String filename, String content); static File createDirectory(String path); static boolean copyMultipartFile(final MultipartFile multipartFile,
			File dest); static Properties readProperty(File f); static void saveProperty(String filename, Properties properties, String header); static String getFilename(String filepath);  }