X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fclient%2FAAConClient.java;h=f7f26038eb03001fe9da7605d7fb9e4964b229df;hb=4c022b67a736b6f79dbe212d73016607cf298422;hp=4619c602dd08b91d1f216bf9c5cd95d6f03f859a;hpb=9d860c3793c6812f643caa01fc80a0036fa3fe2b;p=jabaws.git diff --git a/webservices/compbio/ws/client/AAConClient.java b/webservices/compbio/ws/client/AAConClient.java index 4619c60..f7f2603 100644 --- a/webservices/compbio/ws/client/AAConClient.java +++ b/webservices/compbio/ws/client/AAConClient.java @@ -1,6 +1,6 @@ -/* Copyright (c) 2010 Peter Troshin +/* Copyright (c) 2011 Peter Troshin * - * Amino Acid Conservation Web Service client @version: 1.0 + * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation @@ -30,7 +30,8 @@ import static compbio.ws.client.Constraints.pseparator; import java.io.Closeable; import java.io.File; import java.io.IOException; -import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.Writer; import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -116,13 +117,13 @@ public class AAConClient { if (inputFile != null) { System.out.println("Calculating conservation..."); result = analize(inputFile, msaws, preset, customOptions); - OutputStream outStream = null; + Writer outStream = null; if (outFile != null) { - outStream = IOHelper.getOutStream(outFile); + outStream = IOHelper.getWriter(outFile); } else { // this stream is going to be closed later which is fine as // std.out will not be - outStream = System.out; + outStream = new PrintWriter(System.out, true); } writeOut(outStream, result); // stream is closed in the method no need to close it here @@ -152,17 +153,17 @@ public class AAConClient { * @param result * the AACon scores to output */ - static void writeOut(OutputStream outStream, ScoreManager result) { + static void writeOut(Writer writer, ScoreManager result) { try { - result.writeOut(outStream); + result.writeOut(writer); } catch (IOException e) { System.err .println("Problems writing output file! Stack trace is below: "); e.printStackTrace(); } finally { - if (outStream != null) { + if (writer != null) { try { - outStream.close(); + writer.close(); } catch (IOException ignored) { // e.printStackTrace(); }