@Test public void write() throws Exception { FileUtil.write("test text", file); Assert.assertEquals( "test text", Files.lines(Paths.get(FILE_NAME)).reduce("", (l, r) -> l + r) ); }
public static void write(String text, File target) throws IOException { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter(target); bw = new BufferedWriter(fw); bw.write(text); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } }
FileUtil { public static void write(String text, File target) throws IOException { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter(target); bw = new BufferedWriter(fw); bw.write(text); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } } }
FileUtil { public static void write(String text, File target) throws IOException { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter(target); bw = new BufferedWriter(fw); bw.write(text); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } } private  FileUtil(); }
FileUtil { public static void write(String text, File target) throws IOException { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter(target); bw = new BufferedWriter(fw); bw.write(text); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } } private  FileUtil(); static void write(String text, File target); static Uri getUri(Context context, String authority, File file); static void saveBitmap(Bitmap bitmap, File targetFile, int quality); static void saveBitmap(Bitmap bitmap, File targetFile, Bitmap.CompressFormat format, int quality); static void zip(List<File> sources, File target); static List<File> walk(File source); static List<File> walk(List<File> sources); static String uniqueName(File source, Set<String> taken); static String getFileExtension(File file); static String getFileNameWithoutExtention(File file); }
FileUtil { public static void write(String text, File target) throws IOException { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter(target); bw = new BufferedWriter(fw); bw.write(text); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } } private  FileUtil(); static void write(String text, File target); static Uri getUri(Context context, String authority, File file); static void saveBitmap(Bitmap bitmap, File targetFile, int quality); static void saveBitmap(Bitmap bitmap, File targetFile, Bitmap.CompressFormat format, int quality); static void zip(List<File> sources, File target); static List<File> walk(File source); static List<File> walk(List<File> sources); static String uniqueName(File source, Set<String> taken); static String getFileExtension(File file); static String getFileNameWithoutExtention(File file);  }