More work to disorder prediction client & services.
[jabaws.git] / webservices / compbio / ws / client / AAConClient.java
index 4619c60..3fe638e 100644 (file)
@@ -30,7 +30,8 @@ import static compbio.ws.client.Constraints.pseparator;
 import java.io.Closeable;\r
 import java.io.File;\r
 import java.io.IOException;\r
-import java.io.OutputStream;\r
+import java.io.PrintWriter;\r
+import java.io.Writer;\r
 import java.net.MalformedURLException;\r
 import java.net.URL;\r
 import java.util.List;\r
@@ -116,13 +117,13 @@ public class AAConClient {
                if (inputFile != null) {\r
                        System.out.println("Calculating conservation...");\r
                        result = analize(inputFile, msaws, preset, customOptions);\r
-                       OutputStream outStream = null;\r
+                       Writer outStream = null;\r
                        if (outFile != null) {\r
-                               outStream = IOHelper.getOutStream(outFile);\r
+                               outStream = IOHelper.getWriter(outFile);\r
                        } else {\r
                                // this stream is going to be closed later which is fine as\r
                                // std.out will not be\r
-                               outStream = System.out;\r
+                               outStream = new PrintWriter(System.out, true);\r
                        }\r
                        writeOut(outStream, result);\r
                        // stream is closed in the method no need to close it here\r
@@ -152,17 +153,17 @@ public class AAConClient {
         * @param result\r
         *            the AACon scores to output\r
         */\r
-       static void writeOut(OutputStream outStream, ScoreManager result) {\r
+       static void writeOut(Writer writer, ScoreManager result) {\r
                try {\r
-                       result.writeOut(outStream);\r
+                       result.writeOut(writer);\r
                } catch (IOException e) {\r
                        System.err\r
                                        .println("Problems writing output file! Stack trace is below: ");\r
                        e.printStackTrace();\r
                } finally {\r
-                       if (outStream != null) {\r
+                       if (writer != null) {\r
                                try {\r
-                                       outStream.close();\r
+                                       writer.close();\r
                                } catch (IOException ignored) {\r
                                        // e.printStackTrace();\r
                                }\r