@Override public void writeEndDocument() throws XMLStreamException {
  log.log(Level.FINE,"writeEndDocument()");
  while (current.getElement() != null) {
    writeEndElement();
  }
  try {
    WbXmlEncoder encoder=new WbXmlEncoder(stream,doc,encoderType);
    encoder.encode();
    encoded=true;
  }
 catch (  IOException e) {
    throw new XMLStreamException("Error encoding the WbXML document",e);
  }
}

@ Override public void writeEndDocument ( ) throws XMLStreamException { log . log ( Level . FINE , "writeEndDocument()" ) ; while ( current . getElement ( ) != null ) { writeEndElement ( ) ; } try { WbXmlEncoder encoder = new WbXmlEncoder ( stream , doc , encoderType ) ; encoder . encode ( ) ; encoded = true ; } catch ( IOException e ) { throw new XMLStreamException ( "Error encoding the WbXML document" , e ) ; } }
closes any start tags and writes corresponding end tags . in the wbxml implementation the method also performs the real encoding of the wbxmldocument object ( all the previous staff just construct in memory / java representation object ) .
