public void close ( ) throws IOException { try { if ( ! started ) { handler . startDocument ( ) ; if ( ! icalendarElementExists ) { //don't output a <icalendar> element if the parent is a <icalendar> element start ( ICALENDAR ) ; } } if ( ! icalendarElementExists ) { end ( ICALENDAR ) ; } handler . endDocument ( ) ; } catch ( SAXException e ) { throw new IOException ( e ) ; } if ( writer != null ) { writer . close ( ) ; } }
Terminates the XML document and closes the output stream .