public class StdErrProgressWriter extends java.lang.Object implements ProgressListener
System.err
).Modifier and Type | Field and Description |
---|---|
protected int |
currentStep |
private long |
elapsed |
private long |
estimatedEndDate |
private long |
estimatedLength |
protected boolean |
finished |
protected java.text.DateFormat |
format |
protected java.lang.String |
message |
protected short |
messageLength |
protected int |
newLineWidth |
protected short |
screenWidth |
protected long |
startDate |
protected int |
stepWidth |
protected int |
totalSteps |
Constructor and Description |
---|
StdErrProgressWriter(int totalSteps,
java.lang.String message)
Initialises a progress writer with a
stepWidth of 1. |
StdErrProgressWriter(int totalSteps,
java.lang.String message,
int stepWidth)
Initialises a new progress writer.
|
StdErrProgressWriter(int totalSteps,
java.lang.String message,
int stepWidth,
int newLineWidth) |
Modifier and Type | Method and Description |
---|---|
int |
getCurrentStep() |
java.lang.String |
getMessage() |
private short |
getScreenWidth() |
int |
getSteps() |
void |
insertColumn(int columns,
java.lang.String message) |
void |
insertRow(int rows,
java.lang.String message) |
void |
progress()
Progress by one step.
|
void |
progress(int currentStep)
Progress by the given steps.
|
void |
progress(java.lang.String message)
Progress by one step, and change the message
|
void |
progress(java.lang.String message,
int currentStep)
Progress by the given steps, and change the message
|
void |
setCurrentStep(int currentStep) |
protected java.lang.String message
protected int currentStep
protected int totalSteps
protected int stepWidth
protected long startDate
private long elapsed
private long estimatedLength
private long estimatedEndDate
protected java.text.DateFormat format
protected short messageLength
protected short screenWidth
protected int newLineWidth
protected boolean finished
public StdErrProgressWriter(int totalSteps, java.lang.String message)
stepWidth
of 1.public StdErrProgressWriter(int totalSteps, java.lang.String message, int stepWidth)
totalSteps
- The total number of stepsmessage
- The basic message, "x of y, ETA hh:mm:ss zzz" will be added automatically to this.stepWidth
- How often the message should be updated. Use a bigger stepWidth to improve the performance. The
first and last step are printed regardless of the value of the stepWith.public StdErrProgressWriter(int totalSteps, java.lang.String message, int stepWidth, int newLineWidth)
private short getScreenWidth()
public void progress()
ProgressListener
progress
in interface ProgressListener
public void progress(int currentStep)
ProgressListener
progress
in interface ProgressListener
public void progress(java.lang.String message)
ProgressListener
progress
in interface ProgressListener
public void progress(java.lang.String message, int currentStep)
ProgressListener
progress
in interface ProgressListener
public void insertRow(int rows, java.lang.String message)
insertRow
in interface ProgressListener
public void insertColumn(int columns, java.lang.String message)
insertColumn
in interface ProgressListener
public java.lang.String getMessage()
public int getCurrentStep()
getCurrentStep
in interface ProgressListener
public int getSteps()
public void setCurrentStep(int currentStep)