diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-07-17 20:42:54 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-07-17 20:42:54 +0200 |
commit | c88523b1b84e9226e524e8d9b7ef6987118cd2cd (patch) | |
tree | f7bb3006be1122b6ce97f1c3df807e3c2038597c /src/main/java/de/pixart/messenger/xml | |
parent | 00334edc6f53cf49298f23b4db87e843d1f56542 (diff) |
use helper method to close socket
Diffstat (limited to 'src/main/java/de/pixart/messenger/xml')
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/XmlReader.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/XmlReader.java b/src/main/java/de/pixart/messenger/xml/XmlReader.java index a67442f49..6447f12ef 100644 --- a/src/main/java/de/pixart/messenger/xml/XmlReader.java +++ b/src/main/java/de/pixart/messenger/xml/XmlReader.java @@ -6,14 +6,15 @@ import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; +import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import de.pixart.messenger.Config; -public class XmlReader { - private XmlPullParser parser; +public class XmlReader implements Closeable { + private final XmlPullParser parser; private InputStream is; public XmlReader() { @@ -48,6 +49,11 @@ public class XmlReader { } } + @Override + public void close() { + this.is = null; + } + public Tag readTag() throws IOException { try { while (this.is != null && parser.next() != XmlPullParser.END_DOCUMENT) { |