close parser after parsing

This commit is contained in:
REAndroid 2023-04-20 17:43:18 +02:00
parent 9bb47b6f28
commit 340f8d07f9

View File

@ -57,6 +57,7 @@ public class XMLDocumentParser {
}
}
private void close(){
closeParser();
closeReader();
closeFileInputStream();
mResDocument=null;
@ -91,6 +92,16 @@ public class XMLDocumentParser {
}
}
}
private void closeParser(){
if(!(mParser instanceof Closeable)){
return;
}
Closeable closeable = (Closeable) mParser;
try {
closeable.close();
} catch (IOException ignored) {
}
}
private XMLDocument parseDocument() throws XmlPullParserException, IOException {
mResDocument=null;