Revision: 16777
          http://sourceforge.net/p/gate/code/16777
Author:   markagreenwood
Date:     2013-08-09 11:28:23 +0000 (Fri, 09 Aug 2013)
Log Message:
-----------
another util method to help with FastInfoset exporting from embedded, plus 
pulling the GCP support jar into the plugin so that it will be available to GCP 
when an app includes this plugin

Modified Paths:
--------------
    gate/trunk/plugins/Format_FastInfoset/creole.xml
    
gate/trunk/plugins/Format_FastInfoset/src/gate/corpora/FastInfosetExporter.java

Modified: gate/trunk/plugins/Format_FastInfoset/creole.xml
===================================================================
--- gate/trunk/plugins/Format_FastInfoset/creole.xml    2013-08-09 10:42:23 UTC 
(rev 16776)
+++ gate/trunk/plugins/Format_FastInfoset/creole.xml    2013-08-09 11:28:23 UTC 
(rev 16777)
@@ -2,4 +2,5 @@
 <CREOLE-DIRECTORY>
   <JAR SCAN="true">format-fastinfoset.jar</JAR>
   <JAR>lib/FastInfoset-1.2.13.jar</JAR>
+  <JAR>gcp/fastinfoset4gcp.jar</JAR>
 </CREOLE-DIRECTORY>

Modified: 
gate/trunk/plugins/Format_FastInfoset/src/gate/corpora/FastInfosetExporter.java
===================================================================
--- 
gate/trunk/plugins/Format_FastInfoset/src/gate/corpora/FastInfosetExporter.java 
    2013-08-09 10:42:23 UTC (rev 16776)
+++ 
gate/trunk/plugins/Format_FastInfoset/src/gate/corpora/FastInfosetExporter.java 
    2013-08-09 11:28:23 UTC (rev 16777)
@@ -31,6 +31,7 @@
 import java.awt.event.ActionEvent;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -330,15 +331,25 @@
    * @throws Exception
    */
   public static void export(Document doc, File file) throws Exception {
+    FileOutputStream out = null;
+    try {
+      out = new FileOutputStream(file);
+      export (doc, out);
+    }
+    finally {
+      out.close();
+    }
+  }
+  
+  public static void export(Document doc, OutputStream out) throws Exception {
 
     StAXDocumentSerializer xsw =
-        new StAXDocumentSerializer(new FileOutputStream(file));
+        new StAXDocumentSerializer(out);
 
     xsw.writeStartDocument("1.0");
     DocumentStaxUtils.writeDocument(doc, xsw, "");
     xsw.writeEndDocument();
     xsw.flush();
     xsw.close();
-
   }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to