net.i2p.i2ptunnel.streamr

## Class MultiSource

- java.lang.Object
- - net.i2p.i2ptunnel.streamr.MultiSource

- All Implemented Interfaces:
    Sink, Source

      public class MultiSource
      extends Object
      implements Source, Sink

  Multi-source data distributor that forwards data to multiple sink destinations

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `MultiSource.MSink` Sink wrapper for multi-source destinations.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiSource()` Creates a new multi-source distributor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(MultiSource.MSink ms)`
    `void` | `remove(MultiSource.MSink ms)`
    `void` | `send(Destination ignored_from, int ignored_fromPort, int ignored_toPort, byte[] data)` May throw RuntimeException from underlying sinks
    `void` | `setSink(Sink sink)` Sets the destination sink for all outgoing data.
    `void` | `start()` Initializes the multi-source.
    `void` | `stop()` Stops the multi-source and clears all registered sinks.

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

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

- - ### Constructor Detail

    - #### MultiSource

          public MultiSource()

      Creates a new multi-source distributor.

  - ### Method Detail

    - #### add

          public void add(MultiSource.MSink ms)

    - #### remove

          public void remove(MultiSource.MSink ms)

    - #### send

          public void send(Destination ignored_from,
                           int ignored_fromPort,
                           int ignored_toPort,
                           byte[] data)

      May throw RuntimeException from underlying sinks
      Specified by:
        `send` in interface `Sink`
      Parameters:
        `ignored_from` - some implementations may ignore, may be null in some implementations
        `ignored_fromPort` - I2CP source port, 0-65535
        `ignored_toPort` - I2CP destination port, 0-65535
      Throws:
        `RuntimeException`

    - #### setSink

          public void setSink(Sink sink)

      Sets the destination sink for all outgoing data.
      Specified by:
        `setSink` in interface `Source`
      Parameters:
        `sink` - the sink to receive distributed data

    - #### start

          public void start()

      Initializes the multi-source. No-op for this implementation.
      Specified by:
        `start` in interface `Source`

    - #### stop

          public void stop()

      Stops the multi-source and clears all registered sinks.