List of utility methods to do BufferedWriter Write
void | writeFile(BufferedWriter fw, String line) write File fw.append(line + "\r\n");
|
boolean | writeFile(double[][] toWrite, String outName) Write a double[][] with an arbitrary number of columns to a file. BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(new File(outName))); for (int l = 0; l < toWrite[0].length; l++) { String line = ""; for (int c = 0; c < toWrite.length; c++) { if (c == toWrite.length - 1) { line += toWrite[c][l]; ... |
void | writeFile(File dir, File fileRef, File newFileName, ClassLoader classLoader) Writes fileRef to dir as newFileRef .
if (dir == null || fileRef == null || newFileName == null || "".equals(newFileName) || classLoader == null) { throw new NullPointerException(""); BufferedReader in = new BufferedReader( new InputStreamReader(classLoader.getResourceAsStream(fileRef.getPath()))); dir.mkdirs(); if (newFileName.getPath().lastIndexOf("/") > 0) { ... |
void | writeFile(File src, File dst) write File File parent = dst.getParentFile(); if (!parent.exists()) parent.mkdirs(); byte[] bytes = loadBytes(new FileInputStream(src)); writeBytes(dst, bytes); if (!dst.exists()) throw new RuntimeException("UNABLE TO WRITE FILE: " + dst.getAbsolutePath()); |
void | writeFile(Object msg) write File try { writer.write(msg + "\n"); } catch (IOException e) { e.printStackTrace(); |
void | writeFile(String dir, String file, String content) Write 'content' in 'dir'/'file' File newDir = new File(dir); newDir.mkdirs(); try (FileWriter fw = new FileWriter(dir + "/" + file, false); BufferedWriter output = new BufferedWriter(fw);) { output.write(content); output.flush(); output.close(); } catch (Exception e) { ... |
void | writeFile(String directory, String content, String fileName, boolean deleteFileBeforeWriting) write File try { if (deleteFileBeforeWriting) deleteFile(directory + fileName); BufferedWriter out = new BufferedWriter(new FileWriter(directory + fileName, deleteFileBeforeWriting)); out.write(content); out.close(); } catch (Exception e) { System.out.println("failed to write query"); ... |
void | WriteFile(String file) Write File try { BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("Halo Indonesia"); out.write("\nBaris baru"); out.newLine(); out.write("Apa kabar?"); out.close(); System.out.println("ok"); ... |
void | writeFile(String file, List write File BufferedWriter out = new BufferedWriter(new FileWriter(file)); for (String line : data) { out.write(line); out.newLine(); out.close(); |
void | writeFile(String filename, ArrayList entries) write File File file = new File(filename); file.delete(); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file))); for (int i = 0; i < entries.size(); i++) { String entry = (String) entries.get(i); out.println(entry); out.close(); ... |