Package edu.uiuc.ncsa.security.core.util
Class Pacer
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.Pacer
-
public class Pacer extends Object
A class used in command line utilities. This has little thingies pacing back and forth in front of the user -- it's an ASCII status bar.Usual use
For a long-running task, rather than have the user stare at the screen and having them wonder if the app has hung, start a thread with the task, register this as a listener, then start this. It will pace back and forth until it gets notified the task is done.
Invoke the main method of this to see a demo. Note that the pacing should happen on one line. There are some monitors where this does not do that due to how Java is implemented.
Created by Jeff Gaynor
on 3/26/20 at 10:36 AM
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the current line of text.static void
main(String[] args)
How to use it example.void
pace()
Causes the pacer to pace once.void
pace(long items)
void
pace(long items, String tail)
This will pace, and put a number + message after the pace line.
-
-
-
Constructor Detail
-
Pacer
public Pacer(int n)
This sets how wide the pacer will be ( = 2*n). Be sure to leave space for any comments. A good value is 20.
-
Pacer
public Pacer(String message)
-
-
Method Detail
-
clear
public void clear()
Clears the current line of text. Call this when you want to clear where pacer was.
-
pace
public void pace()
Causes the pacer to pace once.
-
pace
public void pace(long items, String tail)
This will pace, and put a number + message after the pace line. Typical might be pace(counter++, "records read") Which might put out.../.....................\... 1234 records read
- Parameters:
items
- longtail
- java.lang.String
-
pace
public void pace(long items)
-
main
public static void main(String[] args) throws InterruptedException
How to use it example.- Parameters:
args
-- Throws:
InterruptedException
-
-