List of utility methods to do FileWriter Write
void | saveToFile(String location, File tempFile) save To File FileWriter fw = new FileWriter(tempFile.getAbsolutePath(), true); fw.write(location + "\n"); fw.close(); |
void | saveToFile(String path, String line) save To File BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(path, true)); bw.write(line); bw.newLine(); } catch (Exception localException) { try { if (bw != null) { ... |
File | saveToFile(String prefix, Reader input) save To File File file; BufferedWriter bw = null; try { file = File.createTempFile(prefix, null); bw = new BufferedWriter(new FileWriter(file)); BufferedReader inputReader = new BufferedReader(input); String thisLine; while ((thisLine = inputReader.readLine()) != null) { ... |
void | saveToJson(Object object, String file) save To Json Gson gson = new GsonBuilder().setPrettyPrinting().create(); try { Writer writer = new FileWriter(file); writer.write(gson.toJson(object)); writer.close(); } catch (IOException e) { e.printStackTrace(); |
File | saveToTempFile(File folder, String content, String fileType) save To Temp File String uuid = UUID.randomUUID().toString(); File f = new File(folder, uuid + "." + fileType); BufferedWriter out = new BufferedWriter(new FileWriter(f)); out.write(content); out.close(); return f; |
void | saveTreeStructuredGroupList(ArrayList save Tree Structured Group List PrintWriter pw = null; try { pw = new PrintWriter(new BufferedWriter(new FileWriter(filePath)), true); } catch (IOException e) { e.printStackTrace(); System.exit(1); for (ArrayList<T> list : treeStructuredGroupList) { ... |
void | saveTxt(String line, String filename, boolean isEndSave) save Txt try { FileWriter file = new FileWriter(filename, isEndSave); BufferedWriter writer = new BufferedWriter(file); writer.write(line); writer.newLine(); writer.close(); } catch (IOException e) { e.printStackTrace(); ... |
void | saveTxtFile(String fileName, String content) save Txt File File file = new File(fileName + ".txt"); try (FileWriter fw = new FileWriter(file, true)) { fw.write(content + "\n"); fw.flush(); } catch (IOException e) { e.printStackTrace(); |