info.bioinfweb.jphyloio.push

## Class EventForwarder

- java.lang.Object
- - info.bioinfweb.jphyloio.push.EventForwarder

-     public class EventForwarder
      extends java.lang.Object

  Tool class that consumes all events provided by an implementation of `JPhyloIOEventReader` and forwards them to one or more `JPhyloIOEventListener`s.
  Author:
    Ben Stöver

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EventForwarder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<JPhyloIOEventListener>` | `getListeners()` Returns the list of listeners to which this instance forwards its consumed events.
    `void` | `readAll(JPhyloIOEventReader reader)` Consumes all available events from the specified listener and forwards them to the registered listeners.
    `void` | `readCurrentNode(JPhyloIOEventReader reader)` Consumes all events between a start and its respective end event.
    `void` | `readUntil(JPhyloIOEventReader reader, EventContentType type)` Consumes all available events from the specified listener and forwards them to the registered listeners until an event of the specified type is reached.
    `void` | `readUntil(JPhyloIOEventReader reader, java.util.Set<EventContentType> types)` Consumes all available events from the specified listener and forwards them to the registered listeners until any event of one of the specified types is reached.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EventForwarder

          public EventForwarder()

  - ### Method Detail

    - #### getListeners

          public java.util.List<JPhyloIOEventListener> getListeners()

      Returns the list of listeners to which this instance forwards its consumed events.
      Returns:
        the modifiable listener list

    - #### readAll

          public void readAll(JPhyloIOEventReader reader)
                       throws java.io.IOException

      Consumes all available events from the specified listener and forwards them to the registered listeners.
      Parameters:
        `reader` - the reader to read the events from
      Throws:
        `java.io.IOException` - if `reader` throws an I/O exception while parsing

    - #### readUntil

          public void readUntil(JPhyloIOEventReader reader,
                                EventContentType type)
                         throws java.io.IOException

      Consumes all available events from the specified listener and forwards them to the registered listeners until an event of the specified type is reached. (The event of the specified type is not consumed.)
      Parameters:
        `reader` - the reader to read the events from
        `type` - the type of the event that shall trigger the end of reading
      Throws:
        `java.io.IOException` - if `reader` throws an I/O exception while parsing

    - #### readUntil

          public void readUntil(JPhyloIOEventReader reader,
                                java.util.Set<EventContentType> types)
                         throws java.io.IOException

      Consumes all available events from the specified listener and forwards them to the registered listeners until any event of one of the specified types is reached. (The event of the specified type is not consumed.)
      Parameters:
        `reader` - the reader to read the events from
        `types` - a set of types of the events that shall trigger the end of reading
      Throws:
        `java.io.IOException` - if `reader` throws an exception while parsing

    - #### readCurrentNode

          public void readCurrentNode(JPhyloIOEventReader reader)
                               throws java.io.IOException

      Consumes all events between a start and its respective end event. The reader must be positioned at a start event when calling this method and will consume all events including the respective end event on the same level.
      Parameters:
        `reader` - the reader to read the events from
      Throws:
        `java.io.IOException` - if `reader` throws an I/O exception while parsing