List of utility methods to do Text File Write
void | writeFile(String filepath, String text) write File OutputStreamWriter wr = null; try { File file = new File(filepath); if (!file.exists()) { file.getParentFile().mkdirs(); wr = new OutputStreamWriter(new FileOutputStream(filepath, false), "UTF8"); ... |
boolean | writeStringToFile(String text, String filePath) write String To File OutputStream os = null; try { File file = new File(filePath); if (file.exists()) { file.delete(); file.createNewFile(); os = new FileOutputStream(file); ... |
Boolean | writeToSDFile(String directory, String file_name, String text) write To SD File File root = Environment.getExternalStorageDirectory(); File dir = new File(root.getAbsolutePath() + "/" + directory); dir.mkdirs(); File file = new File(dir, file_name); try { FileOutputStream f = new FileOutputStream(file); PrintWriter pw = new PrintWriter(f); pw.println(text); ... |
void | writeFileEnd(String filepath, String text) write File End OutputStreamWriter wr = null; try { File file = new File(filepath); if (!file.exists()) { file.getParentFile().mkdirs(); wr = new OutputStreamWriter( new FileOutputStream(filepath, true), "UTF8"); ... |
void | WriteFile(String file, String message) Write File File f = new File(file); if (!f.exists()) { f.createNewFile(); FileOutputStream fout = new FileOutputStream(file); byte[] bytes = message.getBytes(); fout.write(bytes); fout.close(); ... |
void | writeNewFile(String filePath, String fileContents) write New File File f = new File(filePath); if (f.exists()) { f.delete(); try { FileWriter fstream = new FileWriter(f); BufferedWriter out = new BufferedWriter(fstream); out.write(fileContents); ... |
void | writeStringToFile(File file, String data) write String To File FileWriter writer = null; try { if (file.exists()) file.delete(); file.createNewFile(); writer = new FileWriter(file); writer.write(data); writer.close(); ... |
void | writeTextFile(File file, String str) write Text File DataOutputStream out = null; if (null != file) { try { out = new DataOutputStream(new FileOutputStream(file)); out.write(str.getBytes()); } finally { if (out != null) { out.close(); ... |
void | writeTextFile(File file, String[] strArray) write Text File String str = ""; if (null != file && null != strArray) { for (int i = 0; i < strArray.length; i++) { str += strArray[i]; if (i != strArray.length - 1) str += "\r\n"; DataOutputStream out = null; ... |