XMLStreamReader getXMLStreamReaderImpl(XMLInputSource inputSource) throws javax.xml.stream.XMLStreamException{
//1. if the temp reader is null -- create the instance and return
if(fTempReader == null){
fPropertyChanged = false;
return fTempReader = new XMLStreamReaderImpl(inputSource,
new PropertyManager(fPropertyManager));
}
//if factory is configured to reuse the instance & this instance can be reused
//& the setProperty() hasn't been called
if(fReuseInstance && fTempReader.canReuse() && !fPropertyChanged){
if(DEBUG)System.out.println("Reusing the instance");
//we can make setInputSource() call reset() and this way there wont be two function calls
fTempReader.reset();
fTempReader.setInputSource(inputSource);
fPropertyChanged = false;
return fTempReader;
}else{
fPropertyChanged = false;
//just return the new instance.. note that we are not setting fTempReader to the newly created instance
return fTempReader = new XMLStreamReaderImpl(inputSource,
new PropertyManager(fPropertyManager));
}
}