public T setDuration(long duration, TimeUnit units) {
    checkNotNull(units);

    this.duration = units.toMillis(duration);

    return getThis();
  }
public T setDuration ( long duration , TimeUnit units ) { checkNotNull ( units ) ; this . duration = units . toMillis ( duration ) ; return getThis ( ) ; }
Stop writing the output after duration is reached.

@param duration The duration
@param units The units the duration is in
@return this