mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 02:27:58 +01:00
[xmlparser] Add SmackXmlParser.newXmlParser(InputStream)
This commit is contained in:
parent
a806595a77
commit
cd33b885ae
1 changed files with 11 additions and 0 deletions
|
@ -16,7 +16,12 @@
|
|||
*/
|
||||
package org.jivesoftware.smack.xml;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
|
@ -66,4 +71,10 @@ public class SmackXmlParser {
|
|||
return xmlPullParserFactory.newXmlPullParser(reader);
|
||||
}
|
||||
|
||||
public static XmlPullParser newXmlParser(InputStream inputStream) throws XmlPullParserException {
|
||||
CharsetDecoder utf8Decoder = StandardCharsets.UTF_8.newDecoder();
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, utf8Decoder);
|
||||
Reader reader = new BufferedReader(inputStreamReader);
|
||||
return newXmlParser(reader);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue