Package org.fusesource.jansi
Class Ansi
java.lang.Object
org.fusesource.jansi.Ansi
- Direct Known Subclasses:
Ansi.NoAnsi
Provides a fluent API for generating
ANSI escape sequences.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Display attributes, also know as SGR (Select Graphic Rendition) parameters.static enum
ANSI 8 colors for fluent APIstatic enum
ED (Erase in Display) / EL (Erase in Line) parameter (see CSI sequence J and K)private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
static final String
private static final char
private static final InheritableThreadLocal
<Boolean> private static final char
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Ansi
_appendEscapeSequence
(char command, Object... options) a
(boolean value) a
(char value) a
(char[] value) a
(char[] value, int offset, int len) a
(double value) a
(float value) a
(int value) a
(long value) a
(CharSequence value) a
(CharSequence value, int start, int end) a
(StringBuffer value) a
(Ansi.Attribute attribute) static Ansi
ansi()
static Ansi
ansi
(int size) static Ansi
ansi
(StringBuilder builder) private Ansi
appendEscapeSequence
(char command) private Ansi
appendEscapeSequence
(char command, int option) private Ansi
appendEscapeSequence
(char command, Object... options) bg
(Ansi.Color color) bgBright
(Ansi.Color color) bgCyan()
bgGreen()
bgRed()
bgYellow()
bold()
boldOff()
cursor
(int row, int column) Moves the cursor to row n, column m.cursorDown
(int y) cursorDownLine
(int n) cursorLeft
(int x) cursorRight
(int x) cursorToColumn
(int x) cursorUp
(int y) cursorUpLine
(int n) eraseLine
(Ansi.Erase kind) eraseScreen
(Ansi.Erase kind) fg
(Ansi.Color color) fgBlack()
fgBlue()
fgBright
(Ansi.Color color) fgCyan()
fgGreen()
fgRed()
fgYellow()
private void
static boolean
static boolean
newline()
Uses theAnsiRenderer
to generate the ANSI escape sequences for the supplied text.String formats and renders the supplied arguments.reset()
Deprecated.scrollDown
(int rows) scrollUp
(int rows) static void
setDetector
(Callable<Boolean> detector) static void
setEnabled
(boolean flag) toString()
-
Field Details
-
FIRST_ESC_CHAR
private static final char FIRST_ESC_CHAR- See Also:
-
SECOND_ESC_CHAR
private static final char SECOND_ESC_CHAR- See Also:
-
DISABLE
-
detector
-
holder
-
builder
-
attributeOptions
-
-
Constructor Details
-
Ansi
public Ansi() -
Ansi
-
Ansi
public Ansi(int size) -
Ansi
-
-
Method Details
-
setDetector
-
isDetected
public static boolean isDetected() -
setEnabled
public static void setEnabled(boolean flag) -
isEnabled
public static boolean isEnabled() -
ansi
-
ansi
-
ansi
-
fg
-
fgBlack
-
fgBlue
-
fgCyan
-
fgDefault
-
fgGreen
-
fgMagenta
-
fgRed
-
fgYellow
-
bg
-
bgCyan
-
bgDefault
-
bgGreen
-
bgMagenta
-
bgRed
-
bgYellow
-
fgBright
-
fgBrightBlack
-
fgBrightBlue
-
fgBrightCyan
-
fgBrightDefault
-
fgBrightGreen
-
fgBrightMagenta
-
fgBrightRed
-
fgBrightYellow
-
bgBright
-
bgBrightCyan
-
bgBrightDefault
-
bgBrightGreen
-
bgBrightMagenta
-
bgBrightRed
-
bgBrightYellow
-
a
-
cursor
Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted. A sequence such as CSI ;5H is a synonym for CSI 1;5H as well as CSI 17;H is the same as CSI 17H and CSI 17;1H- Parameters:
row
- row (1-based) from topcolumn
- column (1 based) from left- Returns:
- Ansi
-
cursorToColumn
-
cursorUp
-
cursorDown
-
cursorRight
-
cursorLeft
-
cursorDownLine
-
cursorDownLine
-
cursorUpLine
-
cursorUpLine
-
eraseScreen
-
eraseScreen
-
eraseLine
-
eraseLine
-
scrollUp
-
scrollDown
-
saveCursorPosition
-
restorCursorPosition
Deprecated. -
restoreCursorPosition
-
reset
-
bold
-
boldOff
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
a
-
newline
-
format
-
render
Uses theAnsiRenderer
to generate the ANSI escape sequences for the supplied text.- Parameters:
text
- text- Returns:
- this
- Since:
- 1.1
-
render
String formats and renders the supplied arguments. Uses theAnsiRenderer
to generate the ANSI escape sequences.- Parameters:
text
- formatargs
- arguments- Returns:
- this
- Since:
- 1.1
-
toString
-
appendEscapeSequence
-
appendEscapeSequence
-
appendEscapeSequence
-
flushAttributes
private void flushAttributes() -
_appendEscapeSequence
-