aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/xml/TagWriter.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/xml/TagWriter.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/xml/TagWriter.java b/src/de/gultsch/chat/xml/TagWriter.java
new file mode 100644
index 00000000..35f27477
--- /dev/null
+++ b/src/de/gultsch/chat/xml/TagWriter.java
@@ -0,0 +1,46 @@
+package de.gultsch.chat.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import android.util.Log;
+
+public class TagWriter {
+
+ OutputStreamWriter writer;
+
+ public TagWriter() {
+
+ }
+
+ public TagWriter(OutputStream out) {
+ this.setOutputStream(out);
+ }
+
+ public void setOutputStream(OutputStream out) {
+ this.writer = new OutputStreamWriter(out);
+ }
+
+ public TagWriter beginDocument() throws IOException {
+ writer.write("<?xml version='1.0'?>");
+ return this;
+ }
+
+ public TagWriter writeTag(Tag tag) throws IOException {
+ writer.write(tag.toString());
+ return this;
+ }
+
+ public void flush() throws IOException {
+ writer.flush();
+ }
+
+ public void writeString(String string) throws IOException {
+ writer.write(string);
+ }
+
+ public void writeElement(Element element) throws IOException {
+ writer.write(element.toString());
+ }
+}