Here you can find the source of newPullParser(InputStream input)
Parameter | Description |
---|---|
input | the input stream to be parsed. |
Parameter | Description |
---|---|
XmlPullParserException | if unable to create a parser from the stream |
public static XmlPullParser newPullParser(InputStream input) throws XmlPullParserException
//package com.java2s; import java.io.InputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; public class Main { private static XmlPullParserFactory sFactory; /**/* www .j ava 2s .c o m*/ * Create the factory if necessary and return a new pull parser. * * @param input the input stream to be parsed. * @return a newly created parser * @throws XmlPullParserException if unable to create a parser from the stream */ public static XmlPullParser newPullParser(InputStream input) throws XmlPullParserException { if (sFactory == null) { sFactory = XmlPullParserFactory.newInstance(); } final XmlPullParser parser = sFactory.newPullParser(); parser.setInput(input, null); return parser; } }