java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.i2ptunnel.I2PTunnelOutproxyRunner.StreamForwarder
All Implemented Interfaces:
Runnable
Enclosing class:
I2PTunnelOutproxyRunner

private class I2PTunnelOutproxyRunner.StreamForwarderextends I2PAppThread
Forwards data from InputStream to OutputStream. Flushes are batched by checking available bytes without forced sleeps.
  • Field Details

    • in

      private final InputStream in
      Stream the data is read from.
    • out

      private final OutputStream out
      Stream the data is written to.
    • direction

      private final String direction
      Name of the direction being copied.
    • _toI2P

      private final boolean _toI2P
      True when copying toward I2P.
    • _cache

      private final ByteCache _cache
      Cache supplying the copy buffers.
  • Constructor Details

    • StreamForwarder

      private StreamForwarder(InputStream in, OutputStream out, boolean toI2P)
      Constructs a forwarder thread for one data direction.
      Parameters:
      in - InputStream to read from
      out - OutputStream to write to
      toI2P - true if forwarding toward I2P side
  • Method Details

    • run

      public void run()
      Pump datagrams between the external socket and the tunnel until either side closes.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class I2PThread