Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java framework for reading / writing ANSI escape-sequenced character streams

Reading ANSI escape sequences is nitty gritty and very easy to get wrong. I am after a library that includes an abstraction for reading escaped sequences preferrably as instances of some nice type. It would be nice if the library offered strongly types rather than everything is a strong and good luck do the stuff yourself.

Any pointers to a foss library would be appreciated.

A similar question A library to convert ANSI escapes (terminal formatting/color codes) to HTML which seems to have a similar motivation also remains unanswered.

like image 536
mP. Avatar asked Jun 29 '11 11:06

mP.


People also ask

How do you write an escape sequence in Java?

A character with a backslash (\) just before it is an escape sequence or escape character.

What does \b do in Java?

However, the Java compiler treats the "\b" literal as a Java escape sequence, and the string WORDS silently compiles to a regular expression that checks for a single backspace character.

How do ANSI escape codes work?

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text.


1 Answers

You may want to take a look at Jansi.
Here is the homepage and github repo

I hope that helps.

like image 166
c00kiemon5ter Avatar answered Oct 03 '22 15:10

c00kiemon5ter