List of utility methods to do PrintWriter Write
void | saveLastExpInfo(String fileName, int[] info) save Last Exp Info if (info.length < 3) return; File file = new File(fileName); PrintWriter writer = new PrintWriter(file); writer.println("NUM_USER " + info[0]); writer.println("TYPE_SPD " + info[1]); writer.println("EXP_ID " + info[2]); writer.close(); ... |
void | saveLine(File file, String line) save Line PrintWriter output = new PrintWriter(file);
output.print(line);
output.close();
|
void | saveList(List list, OutputStream outs) save List PrintWriter out = new PrintWriter(outs); for (int n = 0; n < list.size(); n++) { out.println(list.get(n)); out.flush(); out.close(); |
void | saveMatrixAsADM(AtomicReferenceArray save Matrix As ADM PrintWriter pw; try { pw = new PrintWriter(path); } catch (FileNotFoundException e) { e.printStackTrace(); return; for (int i = 0; i < matrix.length(); i++) { ... |
boolean | saveMineField(File fileName, String mineField) save Mine Field assert (fileName != null); PrintWriter pos = null; try { pos = new PrintWriter(new FileOutputStream(fileName, false), true); } catch (Exception e) { e.printStackTrace(System.out); try { ... |
void | saveProbabilityData(String file, double[] probabilities, double start, double dt) save Probability Data try { File dataFile = new File(file + File.separator + "output.dat"); PrintWriter writer = new PrintWriter(dataFile); for (int i = 0; i < probabilities.length; i++) { writer.println((start + (i * dt)) + "\t" + probabilities[i]); writer.close(); } catch (IOException e) { ... |
void | saveProcessedDataFile(double[][] data, String file) Saves the given processed data to the specified file. PrintWriter pw = new PrintWriter(file); for (double[] point : data) { pw.printf("%f %f %f%n", point[0], point[1], point[2]); pw.close(); |
void | saveSet(Set> set, File setFile, String encoding) Save set as string to a file. if (set != null) { PrintWriter printWriter = new PrintWriter(setFile, "utf-8"); Iterator<?> iterator = set.iterator(); while (iterator.hasNext()) { String value = iterator.next().toString(); printWriter.println(value); printWriter.flush(); ... |
void | saveSortedMap(Map, ?> map, File mapFile, String separator, String qualifier, String encoding) Save map to a file in sorted key order. if (map != null) { PrintWriter printWriter = new PrintWriter(mapFile, "utf-8"); Set<Object> keySet = new TreeSet<Object>(map.keySet()); Iterator<Object> iterator = keySet.iterator(); while (iterator.hasNext()) { Object key = iterator.next(); String value = map.get(key).toString(); printWriter.println(qualifier + key + qualifier + separator + qualifier + value + qualifier); ... |
void | saveString(String theFilePath, String theString) save String createPath(theFilePath); saveString(getOutputStream(theFilePath), theString); |