java.lang.Object
net.i2p.sam.client.SAMStreamSink.Sink
Enclosing class:
SAMStreamSink

private class SAMStreamSink.Sinkextends Object
One open SAM session receiving messages.
  • Field Details

    • _connectionId

      private final String _connectionId
      The SAM connection id.
    • _remoteDestination

      private final String _remoteDestination
      The remote destination, for datagram modes.
    • _closed

      private volatile boolean _closed
      Whether the session has been closed.
    • _started

      private final long _started
      When the session opened.
    • _lastReceivedOn

      private long _lastReceivedOn
      When the last message arrived.
    • _out

      private final OutputStream _out
      Stream for sending through this session.
  • Constructor Details

    • Sink

      public Sink(String conId, String remDest) throws IOException
      Opens the sink file and starts the connection lifetime statistics.
      Parameters:
      conId - connection id, names the sink file and the stats
      remDest - remote destination name recorded in the stats
      Throws:
      IOException - if the sink file cannot be created or opened
  • Method Details

    • getConnectionId

      public String getConnectionId()
      SAM connection id.
      Returns:
      the connection id
    • getDestination

      public String getDestination()
      Remote destination of the stream.
      Returns:
      the remote destination string reported when this connection was established, which is used only for logging
    • closed

      public void closed()
      Marks the sink closed and closes its output file.
    • received

      public void received(byte[] data, int offset, int len)
      Appends incoming data to the sink file.
      Parameters:
      data - the received bytes
      offset - start of the data to write within data
      len - number of bytes to write from offset