public class TransferRateProgressReporter extends java.lang.Object implements AbsoluteProgressReporter
Modifier and Type | Field and Description |
---|---|
private int |
maxDelay |
private int |
maxTicksPerSecond |
private AbsoluteProgressReporter |
parent |
private long |
startTime |
Constructor and Description |
---|
TransferRateProgressReporter(AbsoluteProgressReporter parent,
int maxTicksPerSecond)
Create a new progress reporter.
|
TransferRateProgressReporter(AbsoluteProgressReporter parent,
int maxTicksPerSecond,
int maxDelay)
Create a new progress reporter.
|
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.String message)
Forward the call to the parent if one exists.
|
void |
display(int percent,
java.lang.String message)
Forward the call to the parent if one exists.
|
void |
displayAbsolute(long completed,
java.lang.String message)
Forward the call to the parent if one exists.
|
private final AbsoluteProgressReporter parent
private final int maxTicksPerSecond
private final int maxDelay
private long startTime
public TransferRateProgressReporter(AbsoluteProgressReporter parent, int maxTicksPerSecond)
parent
- An optional parent progress reportermaxTicksPerSecond
- Max allowed ticks-per-second, if the rate goes above this,
the displayAbsolute(long, String)
method will wait a short time
before returningpublic TransferRateProgressReporter(AbsoluteProgressReporter parent, int maxTicksPerSecond, int maxDelay)
parent
- An optional parent progress reportermaxTicksPerSecond
- Max allowed ticks-per-second, if the rate goes above this,
the displayAbsolute(long, String)
method will wait a short time
before returningmaxDelay
- The max delay in milliseconds for each call to displayAbsolute(long, String)
public void display(int percent, java.lang.String message)
display
in interface ProgressReporter
percent
- How many percent of the task that is completed
or -1 if not knownmessage
- A message, or nullpublic void append(java.lang.String message)
append
in interface ProgressReporter
message
- The messagepublic void displayAbsolute(long completed, java.lang.String message)
displayAbsolute
in interface AbsoluteProgressReporter
completed
- The progress of the taskmessage
- A message, or null