/**
* Parses input stream as an RSS 2.0 feed.
*
* @return in-memory representation of an RSS feed
* @throws IllegalArgumentException if either argument is {@code null}
*/
private RSSFeed parse(SAXParser parser, InputStream feed)
throws SAXException, IOException {
if (parser == null) {
throw new IllegalArgumentException("RSS parser must not be null.");
} else if (feed == null) {
throw new IllegalArgumentException("RSS feed must not be null.");
}
// SAX automatically detects the correct character encoding from the stream
// See also http://www.w3.org/TR/REC-xml/#sec-guessing
final InputSource source = new InputSource(feed);
final XMLReader xmlreader = parser.getXMLReader();
final RSSHandler handler = new RSSHandler(config);
xmlreader.setContentHandler(handler);
xmlreader.parse(source);
return handler.feed();
}
RSSParser.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:android-tv-news
作者:
评论列表
文章目录