List of utility methods to do Text File Write
boolean | writeStringToFile(String filename, String stringToWrite) write String To File try { FileWriter writer = new FileWriter(new File(filename)); BufferedWriter bw = new BufferedWriter(writer); bw.write(stringToWrite); bw.flush(); bw.close(); return true; } catch (IOException e) { ... |
void | writeStringToFile(String filename, String text) write String To File FileOutputStream stream = null; PrintStream out = null; try { stream = new FileOutputStream(filename); out = new PrintStream(stream); out.print(text); } catch (Exception ex) { ex.printStackTrace(); ... |
void | WriteStringToFile(String fn, String dest) Write string to file. FileOutputStream fo = null; try { fo = new FileOutputStream(fn); fo.write(dest.getBytes()); fo.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { ... |
boolean | writeStringToFile(String fullPath, byte[] fileBytes) write String To File try { BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(fullPath)); bos.write(fileBytes); bos.flush(); bos.close(); } catch (IOException ex) { ex.printStackTrace(); return false; ... |
boolean | writeStringToFile(String fullPath, String content) write String To File try { Writer output = null; File file = new File(fullPath); if (!file.exists()) { file.createNewFile(); output = new BufferedWriter(new FileWriter(file)); output.write(content); ... |
void | writeStringToFile(String jsonStr, File file) write String To File try { OutputStream out = new FileOutputStream(file); ByteArrayInputStream in = new ByteArrayInputStream(jsonStr.getBytes()); byte[] buffer = new byte[1024]; int len = 0; while ((len = in.read(buffer, 0, 1024)) != -1) { out.write(buffer, 0, len); in.close(); out.close(); } catch (Exception e) { |
void | writeStringToFile(String macroContent, File file) write String To File try { java.io.FileWriter w = new java.io.FileWriter(file); w.write(macroContent); w.close(); } catch (Exception e) { |
void | writeStringToFile(String modifiedLine, String filePath) write String To File BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(filePath, true)); bw.write(modifiedLine + "\n"); } catch (IOException e) { e.printStackTrace(); } finally { try { ... |
void | writeStringToFile(String path, String content) write String To File File f = new File(path); FileOutputStream out = new FileOutputStream(f); out.write(content.getBytes()); out.close(); |
void | writeStringToFile(String path, String content) write String To File File file = new File(path); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write(content); } finally { if (writer != null) writer.close(); ... |