Java tutorial
//package com.java2s; import java.io.FileReader; import java.io.IOException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class Main { public static void closeStaxStreamReader(XMLStreamReader xsr, FileReader fr) { try { if (xsr != null) { xsr.close(); } if (fr != null) { fr.close(); } } catch (XMLStreamException ex) { // } catch (IOException ex) { // } } }