diff options
author | David A. Madore <david+git@madore.org> | 2011-08-31 15:13:48 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2011-08-31 15:13:48 +0200 |
commit | 9d7354465ab229641c2da9cfe93584e1c21c6fd8 (patch) | |
tree | 19b9ce5f7e9e070938cd7490692f7d7101eb267a | |
parent | 1710554809835a82415a1f8789bed3016c58fc96 (diff) | |
download | damlengine-9d7354465ab229641c2da9cfe93584e1c21c6fd8.tar.gz damlengine-9d7354465ab229641c2da9cfe93584e1c21c6fd8.tar.bz2 damlengine-9d7354465ab229641c2da9cfe93584e1c21c6fd8.zip |
Use resources for template streams.
-rw-r--r-- | org/madore/damlengine/DamlEngine.java | 12 | ||||
-rw-r--r-- | org/madore/damlengine/WeblogIndexSelect.java | 3 | ||||
-rw-r--r-- | org/madore/damlengine/WeblogSelect.java | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/org/madore/damlengine/DamlEngine.java b/org/madore/damlengine/DamlEngine.java index 6581f37..070cbab 100644 --- a/org/madore/damlengine/DamlEngine.java +++ b/org/madore/damlengine/DamlEngine.java @@ -1,5 +1,7 @@ package org.madore.damlengine; +import java.io.InputStream; +import java.io.FileInputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import javax.xml.XMLConstants; @@ -87,13 +89,13 @@ public final class DamlEngine { processDocument(doc, null); } - public static void fullProcess(String fname, OutputStream out, + public static void fullProcess(InputStream in, OutputStream out, Context.WeblogSelectionContext wsc) throws Exception { final DocumentBuilder db = GetDocumentBuilder.db; - Document doc = db.parse(fname); + Document doc = db.parse(in); processDocument(doc, wsc); doc.normalizeDocument(); Unparser unparser @@ -103,9 +105,9 @@ public final class DamlEngine { } - public static void fullProcess(String fname, OutputStream out) + public static void fullProcess(InputStream in, OutputStream out) throws Exception { - fullProcess(fname, out, null); + fullProcess(in, out, null); } public static void main(String[] args) @@ -116,7 +118,7 @@ public final class DamlEngine { } for (String fname : args) { - fullProcess (fname, System.out); + fullProcess (new FileInputStream(fname), System.out); } } diff --git a/org/madore/damlengine/WeblogIndexSelect.java b/org/madore/damlengine/WeblogIndexSelect.java index 5d6bc53..c9bf617 100644 --- a/org/madore/damlengine/WeblogIndexSelect.java +++ b/org/madore/damlengine/WeblogIndexSelect.java @@ -9,7 +9,8 @@ public final class WeblogIndexSelect { public static void main(String[] args) throws Exception { - DamlEngine.fullProcess("weblog-index-template.daml", System.out, null); + DamlEngine.fullProcess(DamlEngine.class.getResourceAsStream("weblog-index-template.daml"), + System.out, null); } diff --git a/org/madore/damlengine/WeblogSelect.java b/org/madore/damlengine/WeblogSelect.java index ad61cbc..cb263e6 100644 --- a/org/madore/damlengine/WeblogSelect.java +++ b/org/madore/damlengine/WeblogSelect.java @@ -36,7 +36,8 @@ public final class WeblogSelect { wsc.xmlData.add(content); } - DamlEngine.fullProcess("weblog-month-template.daml", System.out, wsc); + DamlEngine.fullProcess(DamlEngine.class.getResourceAsStream("weblog-month-template.daml"), + System.out, wsc); } |