net.i2p.i2ptunnel.udp

## Class I2PSource

- java.lang.Object
- - net.i2p.i2ptunnel.udp.I2PSource

- All Implemented Interfaces:
    Source

      public class I2PSource
      extends Object
      implements Source

  I2P source implementation for streaming data. Refactored in 0.9.53 to support I2CP protocols and ports

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `I2PSource.Listener`
    `static class` | `I2PSource.Protocol` Protocol enum for I2P source handling.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected I2PSession` | `sess`
    `protected Sink` | `sink`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PSource(I2PSession sess)` Handles both REPLIABLE and RAW on any port
    `I2PSource(I2PSession sess, I2PSource.Protocol protocol)` Listen on all I2CP ports.
    `I2PSource(I2PSession sess, I2PSource.Protocol protocol, int port)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setSink(Sink sink)` Sets the sink for received I2P datagrams.
    `void` | `start()` Starts the source to begin receiving datagrams.

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

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

- - ### Field Detail

    - #### sess

          protected final I2PSession sess

    - #### sink

          protected Sink sink

  - ### Constructor Detail

    - #### I2PSource

          public I2PSource(I2PSession sess)

      Handles both REPLIABLE and RAW on any port

    - #### I2PSource

          public I2PSource(I2PSession sess,
                           I2PSource.Protocol protocol)

      Listen on all I2CP ports. No support for arbitrary protocol numbers.
      Parameters:
        `protocol` - REPLIABLE, RAW, or BOTH

    - #### I2PSource

          public I2PSource(I2PSession sess,
                           I2PSource.Protocol protocol,
                           int port)

      Parameters:
        `port` - I2CP port or I2PSession.PORT_ANY
        `protocol` - REPLIABLE, RAW, or BOTH

  - ### Method Detail

    - #### setSink

          public void setSink(Sink sink)

      Sets the sink for received I2P datagrams.
      Specified by:
        `setSink` in interface `Source`
      Parameters:
        `sink` - the sink to receive datagrams

    - #### start

          public void start()

      Starts the source to begin receiving datagrams.
      Specified by:
        `start` in interface `Source`