public void writeCollection(BioCCollection collection)
      throws XMLStreamException {
    if (hasWritten) {
      throw new IllegalStateException(
          "writeCollection can only be invoked once.");
    }
    hasWritten = true;

    writer.writeStartDocument(
        collection.getEncoding(),
        collection.getVersion(),
        collection.isStandalone())
        .writeBeginCollectionInfo(collection);

    for (BioCDocument doc : collection.getDocuments()) {
      writer.write(doc);
    }

    // end collection
    writer.writeEndCollection()
        .writeEndDocument();
  }
public void writeCollection ( BioCCollection collection ) throws XMLStreamException { if ( hasWritten ) { throw new IllegalStateException ( "writeCollection can only be invoked once." ) ; } hasWritten = true ; writer . writeStartDocument ( collection . getEncoding ( ) , collection . getVersion ( ) , collection . isStandalone ( ) ) . writeBeginCollectionInfo ( collection ) ; for ( BioCDocument doc : collection . getDocuments ( ) ) { writer . write ( doc ) ; } writer . writeEndCollection ( ) . writeEndDocument ( ) ; }
Writes the whole BioC collection into the BioC file. This method can only
be called once.

@param collection the BioC collection
@throws XMLStreamException if an unexpected processing error occurs