List of utility methods to do FileWriter Write
void | saveContent(String context, String filename) save Content File file = new File(filename); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e1) { e1.printStackTrace(); try { FileWriter writer = new FileWriter(file, true); writer.append(context); writer.flush(); } catch (IOException e) { e.printStackTrace(); |
void | saveData(Map Saves the dataset. BufferedWriter bw = new BufferedWriter(new FileWriter(file)); for (Entry<String, List<double[]>> classEntry : data.entrySet()) { String classLabel = classEntry.getKey(); for (double[] arr : classEntry.getValue()) { String arrStr = Arrays.toString(arr).replaceAll("[\\]\\[\\s]+", ""); bw.write(classLabel + "," + arrStr + CR); bw.close(); |
void | saveData(Map save Data try { File f = new File(file); if (!f.exists()) { f.createNewFile(); FileWriter fw = new FileWriter(f.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.newLine(); ... |
void | saveData(String fileName, double totalTime, int[] resultSubset) save Data FileWriter fw = null; fw = new FileWriter(fileName); String str1 = "totalTime is:" + totalTime + "\n"; String str2 = "resultSubset: " + "\n"; fw.write(str1); fw.write(str2); String str = ""; for (int i = 0; i < resultSubset.length; i++) { ... |
void | saveDictionary(String fileName, Map values) save Dictionary final BufferedWriter writer = new BufferedWriter(new FileWriter(fileName)); values.entrySet().forEach(p -> { try { writer.write(p.toString()); writer.newLine(); } catch (IOException e) { e.printStackTrace(); }); writer.flush(); writer.close(); |
File | saveDotGraph(final String dotGraph, final File outputDirectory) Save the specified Graphviz's dot file at the top of the specified project. File returnValue; FileWriter fileWriter; returnValue = new File(outputDirectory, "schemas.dot"); fileWriter = new FileWriter(returnValue, false); fileWriter.write(dotGraph); fileWriter.close(); return returnValue; |
void | saveDoubleArray2File(Double[] doubleArray, String fileName) create a new file and save the doubleArray to the fileName FileWriter fw = null; fw = new FileWriter(fileName); String str = ""; for (int i = 0; i < doubleArray.length; i++) { str = str + doubleArray[i]; str = str + "\n"; fw.write(str); ... |
void | saveDoubleArray2FileAppend(Double[] doubleArray, String fileName) save doubleArray to fileName, if the file exists, we just append the double array to the file FileWriter fw = null; fw = new FileWriter(fileName, true); String str = ""; for (int i = 0; i < doubleArray.length; i++) { str = str + doubleArray[i]; str = str + "\n"; fw.write(str); ... |
void | saveEasyQuestImpl(final String quest, final File targetFile) save Easy Quest Impl final File backupFile = new File(targetFile.getAbsolutePath() + ".bak"); FileWriter fw = null; try { if (backupFile.exists()) { backupFile.delete(); if (targetFile.exists()) { targetFile.renameTo(backupFile); ... |
void | saveFile(File directory, String fileName, String content) This method save the String content in a file which name is fileName . BufferedWriter output; FileWriter file = new FileWriter(directory.getAbsolutePath() + File.separator + fileName); output = new BufferedWriter(file); output.write(content); output.close(); |