List of utility methods to do FileWriter Write
void | saveFile(String path, String sb) save File try { FileWriter fstream = new FileWriter(path); try (BufferedWriter out = new BufferedWriter(fstream)) { out.write(sb); } catch (Exception e) { System.err.println("Error save file: "); System.err.println(path); ... |
void | saveFile(String[] lines, String savedName, String extension) save File FileWriter fw = new FileWriter("src/main/java/es/uniovi/asw/data/" + savedName + "." + extension); for (int i = 0; i < lines.length; i++) { fw.write(lines[i] + "\n"); fw.close(); |
void | saveFileContents(File file, String contents) save File Contents try { FileWriter fw = new FileWriter(file); fw.write(contents); fw.close(); } catch (IOException e) { throw new RuntimeException(e); |
void | saveFileFromString(File file, String encoding, String content) writes string to a file if (content == null) { return; char[] buf = new char[content.length()]; content.getChars(0, buf.length, buf, 0); OutputStreamWriter f = encoding == null ? new FileWriter(file) : new OutputStreamWriter(new FileOutputStream(file), encoding); try { ... |
void | saveFiles(final List Save file contents in an output directory. int index; File directory; File rooScriptFile; FileWriter fileWriter; directory = new File(outputDirectory, outputName); directory.mkdir(); index = 0; for (String content : contents) { ... |
void | saveFlows(Map save Flows try { File f = new File(file); if (!f.exists()) { f.createNewFile(); FileWriter fw = new FileWriter(f.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write("gene\tflows"); ... |
void | saveFormedClustersToFile(Vector Takes a list of clusters (a cluster is a set of integers), and maps the integer IDs to the given list of string entity names. try { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); for (Set<Integer> cluster : clusters) { boolean first = true; for (Integer nameID : cluster) { if (!first) writer.write(", "); writer.write(names.get(nameID)); ... |
void | saveGraph(List
Saves a graph into a csv file in the format of tuples (vertex,edge) for every edge in the graph. FileWriter writer = new FileWriter(sFileName); writer.append("Vertex,Edge\n"); for (Integer i = 0; i < graph.size(); i++) { for (int j = 0; j < graph.get(i).size(); j++) { writer.append(i.toString()); writer.append(','); writer.append(graph.get(i).get(j).toString()); writer.append('\n'); ... |
void | saveIndex(File root_, Hashtable index) Saves an index (Hashtable) to a file. saveIndex(root_, "index", index);
|
void | saveInputStreamInFile(InputStream stream, FileWriter f) save Input Stream In File InputStreamReader st = new InputStreamReader(stream); BufferedReader br = new BufferedReader(st); String line; try { while ((line = br.readLine()) != null) f.append(line + "\n"); } finally { st.close(); ... |