Here you can find the source of getXMLStreamReader(File file)
public static XMLStreamReader getXMLStreamReader(File file) throws XMLStreamException, FileNotFoundException
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class Main { private static XMLInputFactory staxInputFactory; public static XMLStreamReader getXMLStreamReader(File file) throws XMLStreamException, FileNotFoundException { InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); return getStaxInputFactory().createXMLStreamReader(inputStream); }/*from www .j a va 2 s. co m*/ public static XMLInputFactory getStaxInputFactory() { if (staxInputFactory == null) { staxInputFactory = XMLInputFactory.newInstance(); } return staxInputFactory; } }