Top Description Inners Fields Constructors Methods
org.fusesource.jansi

public Class Ansi

extends Object
implements Appendable
Class Inheritance
All Implemented Interfaces
java.lang.Appendable
Known Direct Subclasses
org.fusesource.jansi.Ansi.NoAnsi
Imports
java.util.ArrayList, java.util.concurrent.Callable

Provides a fluent API for generating ANSI escape sequences.
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static enum
Ansi.Color

ANSI 8 colors for fluent API

public static interface
public static enum
Ansi.Erase

ED (Erase in Display) / EL (Erase in Line) parameter (see CSI sequence J and K)

private static class

Field Summary

Modifier and TypeField and Description
private final ArrayList<Integer>
private final StringBuilder
private static Callable<Boolean>
public static final String
private static final char
private static final InheritableThreadLocal<Boolean>
private static final char

Constructor Summary

AccessConstructor and Description
public
Ansi()

public
Ansi(Ansi parent)

public
Ansi(int size)

public

Method Summary

Modifier and TypeMethod and Description
private Ansi
_appendEscapeSequence(char command, Object... options)

public Ansi
a(Ansi.Attribute attribute)

public Ansi
a(String value)

public Ansi
a(boolean value)

public Ansi
a(char value)

public Ansi
a(char[] value, int offset, int len)

public Ansi
a(char[] value)

public Ansi
a(CharSequence value, int start, int end)

public Ansi
a(CharSequence value)

public Ansi
a(double value)

public Ansi
a(float value)

public Ansi
a(int value)

public Ansi
a(long value)

public Ansi
a(Object value)

public Ansi
a(StringBuffer value)

public static Ansi
ansi()

public static Ansi
public static Ansi
ansi(int size)

public Ansi
append(CharSequence
The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.
csq
)

Implements java.lang.Appendable.append.

Appends the specified character sequence to this Appendable.
public Ansi
append(CharSequence
The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".
csq
,
int
The index of the first character in the subsequence
start
,
int
The index of the character following the last character in the subsequence
end
)

Implements java.lang.Appendable.append.

Appends a subsequence of the specified character sequence to this Appendable.
public Ansi
append(char
The character to append
c
)

Implements java.lang.Appendable.append.

Appends the specified character to this Appendable.
private Ansi
appendEscapeSequence(char command)

private Ansi
appendEscapeSequence(char command, int option)

private Ansi
appendEscapeSequence(char command, Object... options)

public Ansi

Returns:

this Ansi instance
apply
(Ansi.Consumer
the function to apply
fun
)

Applies another function to this Ansi instance.

public Ansi
bg(Ansi.Color color)

public Ansi
bg(int color)

public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
bgRgb(int color)

public Ansi
bgRgb(int r, int g, int b)

public Ansi
public Ansi
bold()

public Ansi
public Ansi

Returns:

this Ansi instance
cursor
(final int
row (1-based) from top
row
,
final int
column (1 based) from left
column
)

Moves the cursor to row n, column m.

public Ansi

Returns:

this Ansi instance
cursorDown
(final int
the number of lines to move down
y
)

Moves the cursor down.

public Ansi

Returns:

this Ansi instance
cursorDownLine
()

Moves the cursor to the beginning of the line below.

public Ansi

Returns:

this Ansi instance
cursorDownLine
(final int
the number of lines to move the cursor
n
)

Moves the cursor to the beginning of the n-th line below.

public Ansi

Returns:

this Ansi instance
cursorLeft
(final int
the number of characters to move left
x
)

Moves the cursor left.

public Ansi

Returns:

this Ansi instance
cursorMove
(final int
the number of characters to move horizontally
x
,
final int
the number of lines to move vertically
y
)

Moves the cursor relative to the current position.

public Ansi

Returns:

this Ansi instance
cursorRight
(final int
the number of characters to move right
x
)

Moves the cursor right.

public Ansi

Returns:

this Ansi instance
cursorToColumn
(final int
the index (1-based) of the column to move to
x
)

Moves the cursor to column n.

public Ansi

Returns:

this Ansi instance
cursorUp
(final int
the number of lines to move up
y
)

Moves the cursor up.

public Ansi

Returns:

this Ansi instance
cursorUpLine
()

Moves the cursor to the beginning of the line above.

public Ansi

Returns:

this Ansi instance
cursorUpLine
(final int
the number of lines to move the cursor
n
)

Moves the cursor to the beginning of the n-th line above.

public Ansi
public Ansi
eraseLine(final Ansi.Erase kind)

public Ansi
public Ansi
eraseScreen(final Ansi.Erase kind)

public Ansi
fg(Ansi.Color color)

public Ansi
fg(int color)

public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
fgRgb(int color)

public Ansi
fgRgb(int r, int g, int b)

public Ansi
private void
public Ansi
format(String pattern, Object... args)

public static boolean
public static boolean
public Ansi
public Ansi

Returns:

this
render
(final String
text
text
)

Uses the AnsiRenderer to generate the ANSI escape sequences for the supplied text.

public Ansi

Returns:

this
render
(final String
format
text
,
Object...
arguments
args
)

String formats and renders the supplied arguments.

public Ansi
public Ansi
restorCursorPosition()

Deprecated
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
public Ansi
scrollDown(final int rows)

public Ansi
scrollUp(final int rows)

public static void
setDetector(final Callable<Boolean> detector)

public static void
setEnabled(final boolean flag)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait