Package org.eclipse.jgit.transport
Class ProgressSpinner
- java.lang.Object
-
- org.eclipse.jgit.transport.ProgressSpinner
-
public class ProgressSpinner extends java.lang.ObjectA simple spinner connected to anOutputStream.This is class is not thread-safe. The update method may only be used from a single thread. Updates are sent only as frequently as
update()is invoked by the caller, and are capped at no more than 2 times per second by requiring at least 500 milliseconds between updates.- Since:
- 4.2
-
-
Field Summary
Fields Modifier and Type Field Description private static longMIN_REFRESH_MILLISprivate java.lang.Stringmsgprivate longnextUpdateMillisprivate java.io.OutputStreamoutprivate booleanshownprivate intstateprivate static char[]STATESprivate booleanwrite
-
Constructor Summary
Constructors Constructor Description ProgressSpinner(java.io.OutputStream out)Initialize a new spinner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginTask(java.lang.String title, long delay, java.util.concurrent.TimeUnit delayUnits)Begin a time consuming task.voidendTask(java.lang.String result)Denote the current task completed.private voidsend(long now)voidupdate()Update the spinner if it is showing.private voidwrite(java.lang.String s)
-
-
-
Field Detail
-
MIN_REFRESH_MILLIS
private static final long MIN_REFRESH_MILLIS
- See Also:
- Constant Field Values
-
STATES
private static final char[] STATES
-
out
private final java.io.OutputStream out
-
msg
private java.lang.String msg
-
state
private int state
-
write
private boolean write
-
shown
private boolean shown
-
nextUpdateMillis
private long nextUpdateMillis
-
-
Method Detail
-
beginTask
public void beginTask(java.lang.String title, long delay, java.util.concurrent.TimeUnit delayUnits)Begin a time consuming task.- Parameters:
title- description of the task, suitable for human viewing.delay- delay to wait before displaying anything at all.delayUnits- unit fordelay.
-
update
public void update()
Update the spinner if it is showing.
-
send
private void send(long now)
-
endTask
public void endTask(java.lang.String result)
Denote the current task completed.- Parameters:
result- text to print after the task's title"$title ... $result".
-
write
private void write(java.lang.String s)
-
-