[Bojangles-cvs] cvs: bojangles /xml XmlHandler.java
Status: Alpha
Brought to you by:
nehresma
From: kai5263499 <boj...@li...> - 2002-08-22 21:07:11
|
kai5263499 Thu Aug 22 14:07:10 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: Finished gzip saveing option, now i just need to let the user decide when and when not to use it. It also automagically adds a .gz to the end of a gzipped doc. Now to work on opening a document... Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.13 bojangles/xml/XmlHandler.java:1.14 --- bojangles/xml/XmlHandler.java:1.13 Thu Aug 22 06:43:27 2002 +++ bojangles/xml/XmlHandler.java Thu Aug 22 14:07:10 2002 @@ -176,22 +176,24 @@ public void saveXML(File of, boolean wantCompressed) { try { OutputFormat format = OutputFormat.createPrettyPrint(); - OutputStream outfileOrig = new FileOutputStream(of); - - if(wantCompressed) { - File nf = new File(of.getAbsolutePath() + of.getName() + ".gz"); + if(true) { + File nof = new File(of.getAbsolutePath() + ".gz"); + System.out.println(of.getAbsolutePath() + ".gz"); FileOutputStream newStream = new FileOutputStream(of); OutputStream outfile = new GZIPOutputStream(newStream); XMLWriter saver = new XMLWriter(outfile, format); saver.write(this.doc); - System.out.println("Compressed to: " + of.getAbsolutePath() + of.getName() + ".gz"); + // Must flush buffers + outfile.close(); } + else { - XMLWriter saverOrig = new XMLWriter(outfileOrig, format); - saverOrig.write(this.doc); + FileOutputStream outfile = new FileOutputStream(of); + XMLWriter saver = new XMLWriter(outfile, format); + saver.write(this.doc); + outfile.close(); } - - } + } catch (Exception e) { e.printStackTrace(); } |