Class Ansi
java.lang.Object
net.orbyfied.j8.util.logging.formatting.Ansi
Main class for ANSI information.
Special thanks to: https://github.com/dialex/JColor for showing me how to do RGB codes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
ESC_CHAR
public static final char ESC_CHARThe escape character which denotes the ANSI code.- See Also:
-
SEPARATOR
The separator between ANSI attributes.- See Also:
-
PREFIX
Every ANSI attribute/sequence starts like this.- See Also:
-
SUFFIX
Every ANSI attribute/sequence ends like this.- See Also:
-
-
Constructor Details
-
Ansi
public Ansi()
-
-
Method Details
-
encode
Encodes an array of attributes into a valid ANSI sequence.- Parameters:
attributes- The specified of the attributes.- Returns:
- The encoded sequence.
-
translate
Parses a string with sequences prefixed by 'prefix' (+'hexprefix' if RGB) to a string with ANSI attributes.- Parameters:
s- The string to parse.prefix- The prefix of all of the sequences.hexprefix- The prefix of all of the RGB (hexadecimal) sequences. The final prefix isprefix + hexprefix- Returns:
- The parsed string.
-
strip
Strips the string 's' of all of its ANSI sequences.- Parameters:
s- The string.- Returns:
- The stripped string.
-