info.bioinfweb.jphyloio.dataadapters

## Interface JPhyloIOEventReceiver

- All Known Implementing Classes:
    AbstractNeXMLDataReceiver, AbstractNexusEventReceiver, AbstractNexusSetsEventReceiver, AbstractSequenceContentReceiver, AbstractXMLDataReceiver, BasicEventReceiver, BasicTextCommentEventReceiver, CharacterSetEventReceiver, NewickNodeEdgeEventReceiver, NeXMLAttributeMetadataReceiver, NeXMLCharacterSetEventReceiver, NeXMLCollectCharSetDataReceiver, NeXMLCollectNamespaceReceiver, NeXMLCollectSequenceDataReceiver, NeXMLCollectSetMetadataReceiver, NeXMLCollectTokenSetDefinitionDataReceiver, NeXMLHandleSequenceDataReceiver, NeXMLIgnoreCertainMetadataReceiver, NeXMLMetaDataReceiver, NeXMLMolecularDataTokenDefinitionReceiver, NeXMLOnlyWriteMetaDataReceiver, NeXMLPredicateMetaReceiver, NeXMLSequenceTokensReceiver, NeXMLTokenSetEventReceiver, PhyloXMLCollectMetadataDataReceiver, PhyloXMLMetaDataReceiver, PhyloXMLOnlyCustomXMLDataReceiver, PhyloXMLPropertyMetadataReceiver, PhyloXMLSpecificPredicatesDataReceiver, ReferenceOnlySetReceiver, TextSequenceContentReceiver, TokenSetEventReceiver

      public interface JPhyloIOEventReceiver

  Implementations of this interface are used by JPhyloIO writers to receive events from the application (generated from its business model).
  Author:
    Ben Stöver

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(JPhyloIOEvent event)` Adds a new event to the sequence written to this receiver.

- - ### Method Detail

    - #### add

          boolean add(JPhyloIOEvent event)
               throws java.io.IOException

      Adds a new event to the sequence written to this receiver.

      Note that this acceptor indicates whether writing events shall be aborted by its return value. This maybe the case, if the writer providing this acceptor was seeking for a specific piece of information and is (currently) not interested in the remaining events. Data adapter implemented by applications should consider the return value to allow saving runtime. If event writing goes on after `false` was returned, subsequent events will be ignored but no exception will be thrown.

      Conversely, a return value of `true` does not necessarily mean that more events are expected in order to complete the expected information.

      Exceptions thrown by this instance should not be caught within any of the `write*()` methods in application implementations of any data adapter (e.g. `MatrixDataAdapter.writeSequencePartContentData(ReadWriteParameterMap, JPhyloIOEventReceiver, String, long, long)`. They will be forwarded by the calling writer and can be handled by the application when `JPhyloIOEventWriter.writeDocument(DocumentDataAdapter, Writer, ReadWriteParameterMap)` (or one of the other overloaded versions) are called.

      Parameters:
        `event` - the event to be add
      Returns:
        `true` if more events can be written to this acceptor or `false` if writing should be aborted
      Throws:
        `IllegalEventException` - if the specified event is illegal in this acceptor in general or at the current position in the sequence
        `java.lang.ClassCastException` - if an event object was specified that is not an instance of a class associated with its type as document in `EventContentType`
        `java.io.IOException` - if an I/O error occurs when writing to the underlying stream