code clean up in TagWriter
This commit is contained in:
parent
2553895300
commit
cdc239b040
|
@ -53,37 +53,33 @@ public class TagWriter {
|
||||||
this.outputStream = new OutputStreamWriter(out);
|
this.outputStream = new OutputStreamWriter(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagWriter beginDocument() throws IOException {
|
public void beginDocument() throws IOException {
|
||||||
if (outputStream == null) {
|
if (outputStream == null) {
|
||||||
throw new IOException("output stream was null");
|
throw new IOException("output stream was null");
|
||||||
}
|
}
|
||||||
outputStream.write("<?xml version='1.0'?>");
|
outputStream.write("<?xml version='1.0'?>");
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized TagWriter writeTag(Tag tag) throws IOException {
|
public synchronized void writeTag(Tag tag) throws IOException {
|
||||||
if (outputStream == null) {
|
if (outputStream == null) {
|
||||||
throw new IOException("output stream was null");
|
throw new IOException("output stream was null");
|
||||||
}
|
}
|
||||||
outputStream.write(tag.toString());
|
outputStream.write(tag.toString());
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized TagWriter writeElement(Element element) throws IOException {
|
public synchronized void writeElement(Element element) throws IOException {
|
||||||
if (outputStream == null) {
|
if (outputStream == null) {
|
||||||
throw new IOException("output stream was null");
|
throw new IOException("output stream was null");
|
||||||
}
|
}
|
||||||
outputStream.write(element.toString());
|
outputStream.write(element.toString());
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagWriter writeStanzaAsync(AbstractStanza stanza) {
|
public void writeStanzaAsync(AbstractStanza stanza) {
|
||||||
if (finished) {
|
if (finished) {
|
||||||
Log.d(Config.LOGTAG,"attempting to write stanza to finished TagWriter");
|
Log.d(Config.LOGTAG, "attempting to write stanza to finished TagWriter");
|
||||||
return this;
|
|
||||||
} else {
|
} else {
|
||||||
if (!asyncStanzaWriter.isAlive()) {
|
if (!asyncStanzaWriter.isAlive()) {
|
||||||
try {
|
try {
|
||||||
|
@ -93,7 +89,6 @@ public class TagWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeQueue.add(stanza);
|
writeQueue.add(stanza);
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue