public void writePhylip(File file) { try { PrintStream w; // transparent gz compression if (file.getName().endsWith(".gz")) { w = new PrintStream(new GZIPOutputStream(new FileOutputStream(file))); } else { w = new PrintStream(new FileOutputStream(file)); } writePhylip(w); w.close(); } catch (IOException ex) { Logger.getLogger(MultipleAlignment.class.getName()).log(Level.SEVERE, null, ex); } }