java类javax.xml.stream.util.StreamReaderDelegate的实例源码

XMLStreamReaderUtils.java 文件源码 项目:bag-etl 阅读 27 收藏 0 点赞 0 评论 0
public static XMLStreamReader getXMLStreamReader(InputStream is) throws XMLStreamException, FactoryConfigurationError
{
    //return XMLInputFactory.newInstance().createXMLStreamReader(is);
    return new StreamReaderDelegate(XMLInputFactory.newInstance().createXMLStreamReader(is))
    {
        public int next() throws XMLStreamException
        {
            while (true)
            {
                int event = super.next();
                switch (event)
                {
                    case XMLStreamConstants.COMMENT:
                    case XMLStreamConstants.PROCESSING_INSTRUCTION:
                        continue;
                    default:
                        return event;
                }
            }
        }
    };
}


问题


面经


文章

微信
公众号

扫码关注公众号