org.sadun.util
Class TelnetInputStreamConsumer.NoMoreInputAvailableCriterium

java.lang.Object
  extended byorg.sadun.util.TelnetInputStreamConsumer.NoMoreInputAvailableCriterium
All Implemented Interfaces:
TelnetInputStreamConsumer.Criterium
Enclosing class:
TelnetInputStreamConsumer

public static class TelnetInputStreamConsumer.NoMoreInputAvailableCriterium
extends java.lang.Object
implements TelnetInputStreamConsumer.Criterium

A criterium which holds if no more input is available within a certain amount of time (i.e. we can suppose that the host has nothing more to say).

The minimum granularity of the timeout is TelnetInputStreamConsumer.BASIC_CRITERIA_CHECK_TIME, that is, timeouts lower than that value won't be enforced.

Author:
Cristiano Sadun

Constructor Summary
TelnetInputStreamConsumer.NoMoreInputAvailableCriterium(boolean cumulative)
          Create a critierium which will hold when no input is received.
TelnetInputStreamConsumer.NoMoreInputAvailableCriterium(boolean cumulative, long waitingTime)
          Create a critierium which will hold when no input is received for a certain waiting time.
 
Method Summary
 boolean holds(java.lang.String input)
          Return true when no input has been received during the time interval defined at construction.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TelnetInputStreamConsumer.NoMoreInputAvailableCriterium

public TelnetInputStreamConsumer.NoMoreInputAvailableCriterium(boolean cumulative,
                                                               long waitingTime)
Create a critierium which will hold when no input is received for a certain waiting time.

Parameters:
cumulative - if true, the criterium will consider the time from the first nonempty input. Otherwise, it will consider the time from the first empty input (that is, receiving input rests the time count).
waitingTime - the time to wait until this criterium holds

TelnetInputStreamConsumer.NoMoreInputAvailableCriterium

public TelnetInputStreamConsumer.NoMoreInputAvailableCriterium(boolean cumulative)
Create a critierium which will hold when no input is received.

The waiting timeis set as double the TelnetInputStreamConsumer.BASIC_CRITERIA_CHECK_TIME.

Parameters:
cumulative - if true, the criterium will consider the time from the first nonempty input. Otherwise, it will consider the time from the first empty input (that is, receiving input rests the time count).
Method Detail

holds

public boolean holds(java.lang.String input)
Return true when no input has been received during the time interval defined at construction.

Specified by:
holds in interface TelnetInputStreamConsumer.Criterium
See Also:
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)

toString

public java.lang.String toString()