public static void append(final String pathname, final String contents) { try { if (!FileManagement.exists(pathname)) { FileManagement.crtFile(pathname); } final FileWriter fw = new FileWriter(pathname, true); final BufferedWriter bw = new BufferedWriter(fw); bw.write(contents); bw.close(); } catch (final IOException e) { e.printStackTrace(); } }
public static void crtFile(final String pathname) throws IOException { final File file = new File(pathname); if ((file.getParentFile() != null) && !file.getParentFile().exists()) { // FileManagement.crtDir(file.getParentFile().getPath()); FileManagement.crtLogDir(file.getParentFile().getPath()); } try { file.createNewFile(); } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public static void crtFile(final File file) throws IOException { FileManagement.crtFile(file.getAbsolutePath()); }