I have a Java program running in command line mode. I would like to display a progress bar, showing the percentage of job done. The same kind of progress bar you would see using wget under unix. Is this possible?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I have recently faced the same problem, you can check my code: I have set it for one # on 5%, which you can modify later.
C# Example but I'm assuming this is the same for
System.out.print
in Java. Feel free to correct me if I'm wrong.Basically, you want to write out the
\r
escape character to the start of your message which will cause the cursor to return to the start of the line (Line Feed) without moving to the next line.There is https://github.com/ctongfei/progressbar, License: MIT
Simple console progress bar. Progress bar writing now runs on another thread.
Menlo, Fira Mono, Source Code Pro or SF Mono are recommended for optimal visual effects.
For Consolas or Andale Mono fonts, use
ProgressBarStyle.ASCII
(see below) because the box-drawing glyphs are not aligned properly in these fonts.Maven:
Usage:
Here is a modified version of the above:
... and in main: