List of utility methods to do Text File Save
void | writeFile(String path, String fileName, String data) write File createPath(path); String fullPath = path + fileName; File file = new File(fullPath); if (!file.exists()) { file.createNewFile(); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file)); bufferedWriter.write(data); ... |
void | writeFile(String path, String text) write File Writer out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), "UTF-8")); out.write(text); } catch (FileNotFoundException e) { } finally { if (out != null) out.close(); ... |
void | writeFile(String path, String text) write File writeFile(new File(path), text, false);
|
void | writeFile(String path, String text, boolean orverWite) write File try { String oldText = ""; if (!orverWite) { oldText = readFile(path); FileOutputStream fos = new FileOutputStream(path); Writer out = new OutputStreamWriter(fos, "UTF-8"); out.write(oldText + text); ... |
void | writeFile(String path, Vector Write a Vector of lines to a file. BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(path)); for (String line : contents) writer.write(line + '\n'); } catch (Exception ex) { System.err.println(ex); } finally { ... |
void | writeFile(String pContent, String pPath) write File File file = new File(pPath); FileWriter fstream; try { fstream = new FileWriter(file); try (BufferedWriter out = new BufferedWriter(fstream)) { out.write(pContent); } catch (IOException e) { ... |
void | writeFile(String ruta, String nombre, byte[] archivo) write File try { FileOutputStream file = null; File onlyCreateDirectory = null; onlyCreateDirectory = new File(ruta); onlyCreateDirectory.mkdirs(); file = new FileOutputStream(ruta + nombre); file.write(archivo); file.flush(); ... |
boolean | WriteFile(String sFileName, String content) Write content to file FileWriter fw = null; try { fw = new FileWriter(sFileName, true); fw.write(content); fw.close(); } catch (IOException e) { e.printStackTrace(); return false; ... |
void | writeFile(String sFileName, String sContent) Writes a String into a given File. FileOutputStream fos = new FileOutputStream(sFileName); for (int i = 0; i < sContent.length(); i++) { fos.write(sContent.charAt(i)); fos.close(); |
void | writeFile(String sName, String data, String encoding) write File File file = new File(sName); try (PrintWriter out = openForWriting(file, encoding)) { out.print(data); |