List of utility methods to do Write String to File
void | writeFile(String content, String writePath, String charCoder) write File try { File file = new File(writePath); OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(file), charCoder); BufferedWriter reader = new BufferedWriter(osw); reader.write(content); osw.flush(); reader.close(); osw.close(); ... |
void | writeFile(String contents, File f) Writes a string to a file. FileWriter fw = null; try { fw = new FileWriter(f); fw.write(contents); } catch (IOException e) { throw new RuntimeException( "workdir is " + System.getProperty("user.dir") + ", couldn't write contents to file: " + e); } finally { ... |
void | writeFile(String contents, File file) Write contents to a file BufferedWriter out = null; try { out = new BufferedWriter(new FileWriter(file)); out.write(contents); } finally { if (out != null) out.close(); |
void | writeFile(String contents, String filename) Writes the given string into the given file. FileWriter fw = new FileWriter(filename);
fw.write(contents);
fw.flush();
fw.close();
|
void | writeFile(String contents, String fileName) write File writeFile(contents, new File(".", fileName)); |
void | writeFile(String data, File file) write File writeFile(data, file, false); |
void | writeFile(String data, File tar) write File writeFile(data.getBytes(), tar); |
void | writeFile(String datafile, String filePath) write File try { Writer output = null; File file = new File(filePath); output = new FileWriter(file); output.write(datafile); output.close(); } catch (IOException ex) { ex.printStackTrace(); ... |
void | writeFile(String destination, byte[] data, boolean append) writeFile File temp = new File(destination); if (temp.exists() && append == true) { FileOutputStream fos = new FileOutputStream(temp, true); try { fos.write(data); fos.flush(); } finally { fos.close(); ... |
void | writeFile(String filename, Object object) write File try { FileOutputStream fout = new FileOutputStream(filename); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(object); oos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { ... |