List of utility methods to do FileWriter Write
void | saveIntegerNodes2File(Integer[] nodes, String fileName) save Integer nodes to the fileName FileWriter fw = null; fw = new FileWriter(fileName); String str = ""; if (nodes != null) { for (int i = 0; i < nodes.length; i++) { str = str + nodes[i]; str = str + "\n"; } else { str = "null"; fw.write(str); fw.close(); |
void | saveIntNodes2File(int[] nodes, String fileName) save int nodes to the fileName FileWriter fw = null; try { fw = new FileWriter(fileName); String str = ""; if (nodes != null) { for (int i = 0; i < nodes.length; i++) { str = str + nodes[i]; str = str + "\n"; ... |
void | saveList(String listName, Set save List try (BufferedWriter bw = new BufferedWriter(new FileWriter(new File(listName)))) { for (String line : list) { bw.write(line); bw.write("\n"); |
boolean | saveListStringToFile(String filePath, List save List String To File System.out.println("Save translation to file " + filePath); try { StringBuffer content = new StringBuffer(); for (String str : listString) { content.append(str + System.getProperty("line.separator")); FileWriter writer = new FileWriter(filePath); writer.write(content.toString()); ... |
void | saveListToFile(ArrayList save List To File File file = new File(filePath); try { FileWriter fw = new FileWriter(file); for (int i = 0; i < list.size(); i++) { String s = list.get(i); fw.write(s + "\n"); System.out.println(s); fw.close(); } catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); |
void | saveMap(Map save Map PrintWriter pw = null; try { pw = new PrintWriter(new BufferedWriter(new FileWriter(filePath)), true); } catch (IOException e) { e.printStackTrace(); exit(1); for (Entry<K, V> entry : map.entrySet()) { ... |
void | saveMap(String filename, Map Saves a map to a file with the given name -- by default, calls the corresponding saveMap() function with a "reverse" parameter of false. saveMap(filename, map, false); |
void | saveMappingFile(File mappingFile, Map save Mapping File FileWriter fw = new FileWriter(mappingFile); for (String message : messageMap.keySet()) { Integer id = messageMap.get(message); fw.append(message).append("=").append(id.toString()).append("\n"); fw.close(); |
void | saveMeasures(String appDirPath, String fileName, double[] measures) save Measures String filePath = appDirPath + File.separator + fileName; PrintWriter pw = null; boolean autoFlush = true; try { pw = new PrintWriter(new BufferedWriter(new FileWriter(filePath)), autoFlush); } catch (IOException e) { e.printStackTrace(); exit(1); ... |
void | saveMetaClassToFile(File baseDir, String clazzDef, String metaPackageName, Class> fromClazz) save Meta Class To File String clazzPcg = packageNameHelper(fromClazz, metaPackageName); String[] pcg = clazzPcg.split("\\."); File dest = baseDir; for (String p : pcg) { dest = new File(dest, p); if (!dest.exists()) dest.mkdir(); dest = new File(dest, classNameHelper(fromClazz) + ".java"); FileWriter write = new FileWriter(dest); write.write(clazzDef); write.close(); |