+\r
+ /**\r
+ * Outputs the List of Score objects into the Output stream. The output\r
+ * format is as follows:\r
+ * \r
+ * <pre>\r
+ * {@code\r
+ * #MethodName <space separated list of values>\r
+ * \r
+ * For example:\r
+ * \r
+ * #KABAT 0.2 0.3 0.2 0 0.645 0.333 1 1 0 0\r
+ * #SMERFS 0.645 0.333 1 1 0 0 0.2 0.3 0.2 0\r
+ * }\r
+ * </pre>\r
+ * \r
+ * The maximum precision for values is 3 digits, but can be less.\r
+ * \r
+ * @param scores\r
+ * the list of scores to output\r
+ * @param output\r
+ * the stream to output the data to\r
+ * @throws IOException\r
+ * if the OutputStream cannot be written into\r
+ * @throws NullPointerException\r
+ * if the output stream is null\r
+ */\r
+ public static void write(Set<Score> scores, OutputStream output)\r
+ throws IOException {\r
+ if (output == null) {\r
+ throw new NullPointerException("OutputStream must be provided!");\r
+ }\r
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(\r
+ output));\r
+ for (Score score : scores) {\r
+ writer.write("#" + score.method + " ");\r
+ for (Float scoreVal : score.getScores()) {\r
+ writer.write(NUMBER_FORMAT.format(scoreVal) + " ");\r
+ }\r
+ writer.write("\n");\r
+ }\r
+ writer.flush();\r
+ }\r