X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fio%2Fwriters%2FPhylogenyWriter.java;h=911ebb5d8437f54cf9ed3fc21018deb1bd5e8519;hb=665e671efec73fcb36a9aac45f119330f290fa81;hp=8c40eae70a0d67506e5ac7b9629c31cbb8b3897b;hpb=10297bd8b8a4b4ab198a17a42fc6ff24ae2ed49b;p=jalview.git diff --git a/forester/java/src/org/forester/io/writers/PhylogenyWriter.java b/forester/java/src/org/forester/io/writers/PhylogenyWriter.java index 8c40eae..911ebb5 100644 --- a/forester/java/src/org/forester/io/writers/PhylogenyWriter.java +++ b/forester/java/src/org/forester/io/writers/PhylogenyWriter.java @@ -27,7 +27,6 @@ package org.forester.io.writers; import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; @@ -399,7 +398,7 @@ public final class PhylogenyWriter { public void toNexus( final File out_file, final Phylogeny tree, final NH_CONVERSION_SUPPORT_VALUE_STYLE svs ) throws IOException { - final Writer writer = new BufferedWriter( new PrintWriter( out_file ) ); + final Writer writer = new BufferedWriter( new PrintWriter( out_file, ForesterConstants.UTF_8 ) ); final List trees = new ArrayList( 1 ); trees.add( tree ); writeNexusStart( writer ); @@ -426,14 +425,14 @@ public final class PhylogenyWriter { final List trees, final int phyloxml_level, final String separator ) throws IOException { - final Writer writer = new BufferedWriter( new PrintWriter( out_file ) ); + final Writer writer = new BufferedWriter( new PrintWriter( out_file, ForesterConstants.UTF_8 ) ); toPhyloXML( writer, trees, phyloxml_level, separator ); writer.flush(); writer.close(); } public void toPhyloXML( final File out_file, final Phylogeny tree, final int phyloxml_level ) throws IOException { - final Writer writer = new BufferedWriter( new PrintWriter( out_file ) ); + final Writer writer = new BufferedWriter( new PrintWriter( out_file, ForesterConstants.UTF_8 ) ); writePhyloXmlStart( writer ); toPhyloXMLNoPhyloXmlSource( writer, tree, phyloxml_level ); writePhyloXmlEnd( writer ); @@ -633,18 +632,8 @@ public final class PhylogenyWriter { if ( out_file.exists() ) { throw new IOException( "attempt to overwrite existing file \"" + out_file.getAbsolutePath() + "\"" ); } - final PrintWriter out = new PrintWriter( new FileWriter( out_file ), true ); - if ( getOutputFormt() == FORMAT.PHYLO_XML ) { - out.print( PHYLO_XML_VERSION_ENCODING_LINE ); - out.print( ForesterUtil.LINE_SEPARATOR ); - out.print( PHYLO_XML_NAMESPACE_LINE ); - out.print( ForesterUtil.LINE_SEPARATOR ); - } + final PrintWriter out = new PrintWriter( out_file, ForesterConstants.UTF_8 ); out.print( sb ); - if ( getOutputFormt() == FORMAT.PHYLO_XML ) { - out.print( ForesterUtil.LINE_SEPARATOR ); - out.print( PHYLO_XML_END ); - } out.flush(); out.close(); } @@ -758,3 +747,7 @@ public final class PhylogenyWriter { NH, NHX, PHYLO_XML, NEXUS; } } + + + +