List of utility methods to do File Save
void | saveIntArray(int[] array, PrintStream out) save Int Array int dim = array.length; out.println(dim); for (int i = 0; i < dim; i++) { out.print(array[i]); if (i != dim - 1) { out.print(" "); out.println(); |
void | SaveIntFile(int[] list, String filename) Save the specified array of ints in the specified file IN PC FORMAT. if (list == null) throw new IllegalArgumentException("Array of ints is null"); if (filename == null) throw new IllegalArgumentException("Filename String is NULL"); byte[] buffer = new byte[4 * list.length]; for (int i = 0; i < list.length; i++) setInt_32(list[i], buffer, 4 * i); try { ... |
String | saveStreamAsString(InputStream is) Read data from Input Stream and save it as a String. return toString(is, ENCODING);
|
void | saveStringDoubleMap(Map save String Double Map out.println(map.size() + " " + dim); for (Entry<String, double[]> entry : map.entrySet()) { out.println(entry.getKey()); for (int i = 0; i < dim; i++) { out.print(entry.getValue()[i]); if (i != dim - 1) { out.print(" "); out.println(); |
void | saveToInputStream(ByteArrayInputStream in, OutputStream out) save To Input Stream try { byte[] buffer = new byte[1024]; int read = 0; while (true) { read = in.read(buffer); if (read <= 0) break; out.write(buffer, 0, read); ... |
void | saveTrecOneEntry(BufferedWriter trecFile, String topicId, String docId, int docPos, float score, String runId) Save positions, scores, etc information for a single retrieved documents. trecFile.write(String.format("%s\tQ0\t%s\t%d\t%f\t%s%s", topicId, docId, docPos, score, runId, NL));
|