简体   繁体   中英

Showing dynamic output in console using Java

When using curl , I've noticed that it outputs to the terminal text that can be then later replaced and updated. This 'dynamic' text output is what I'd like to do.

Specifically:

An execution like: curl http://raw.github.com/someGZippedPackage | gunzip curl http://raw.github.com/someGZippedPackage | gunzip shows the percentage completion and a completion bar in the terminal .

Are there libraries that provide this functionality?

I can use any object-oriented programming language.

Preferably built for either Java or Node.js.

You can probably hack something together using the javacurses library, available here. http://sourceforge.net/projects/javacurses/

If you haven't used curses before, it can be used to provide an interface similar to the one you might see in the BIOS menu. It is the standard way to program menu driven text interfaces, and works for other applications as well.

Here's a solid intro to programming with curses, although actually written for the c library. http://invisible-island.net/ncurses/ncurses-intro.html

Basically move a "cursor" around with move and add characters with addch , then refresh the screen.

Godspeed.

This is called a progress bar , which can be generated without curses, by using backspace and carriage return characters.

This makes your question a duplicate of Command line progress bar in Java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM