public class AnsiConsole extends Object
systemInstall()
,
wrapPrintStream(PrintStream, int) for more details on ANSI mode selection
Modifier and Type | Field and Description |
---|---|
static PrintStream |
err |
static PrintStream |
out |
static PrintStream |
system_err |
static PrintStream |
system_out |
Modifier and Type | Method and Description |
---|---|
static PrintStream |
err()
If the standard out natively supports ANSI escape codes, then this just
returns System.err, otherwise it will provide an ANSI aware PrintStream
which strips out the ANSI escape sequences or which implement the escape
sequences.
|
static PrintStream |
out()
If the standard out natively supports ANSI escape codes, then this just
returns System.out, otherwise it will provide an ANSI aware PrintStream
which strips out the ANSI escape sequences or which implement the escape
sequences.
|
static void |
systemInstall()
Install
AnsiConsole.out to System.out and
AnsiConsole.err to System.err . |
static void |
systemUninstall()
undo a previous
systemInstall() . |
static OutputStream |
wrapErrorOutputStream(OutputStream stream)
Deprecated.
|
static OutputStream |
wrapOutputStream(OutputStream stream)
Deprecated.
|
static OutputStream |
wrapOutputStream(OutputStream stream,
int fileno)
Deprecated.
|
static PrintStream |
wrapPrintStream(PrintStream ps,
int fileno)
Wrap PrintStream applying rules in following order:
if
jansi.passthrough is true , don't wrap but just passthrough (console is
expected to natively support ANSI escape codes),
if jansi.strip is true , just strip ANSI escape codes inconditionally,
if OS is Windows and terminal is not Cygwin or Mingw, wrap as WindowsAnsiPrintStream to process ANSI escape codes,
if file descriptor is a terminal (see isatty(int) ) or jansi.force is true ,
just passthrough,
else strip ANSI escape codes (not a terminal).
|
static PrintStream |
wrapSystemErr(PrintStream ps) |
static PrintStream |
wrapSystemOut(PrintStream ps) |
public static final PrintStream system_out
public static final PrintStream out
public static final PrintStream system_err
public static final PrintStream err
@Deprecated public static OutputStream wrapOutputStream(OutputStream stream)
public static PrintStream wrapSystemOut(PrintStream ps)
@Deprecated public static OutputStream wrapErrorOutputStream(OutputStream stream)
public static PrintStream wrapSystemErr(PrintStream ps)
@Deprecated public static OutputStream wrapOutputStream(OutputStream stream, int fileno)
public static PrintStream wrapPrintStream(PrintStream ps, int fileno)
jansi.passthrough
is true
, don't wrap but just passthrough (console is
expected to natively support ANSI escape codes),jansi.strip
is true
, just strip ANSI escape codes inconditionally,isatty(int)
) or jansi.force
is true
,
just passthrough,ps
- original PrintStream to wrapfileno
- file descriptorpublic static PrintStream out()
wrapPrintStream(PrintStream, int)
public static PrintStream err()
wrapPrintStream(PrintStream, int)
public static void systemInstall()
AnsiConsole.out
to System.out
and
AnsiConsole.err
to System.err
.systemUninstall()
public static void systemUninstall()
systemInstall()
. If systemInstall()
was called
multiple times, systemUninstall()
must be called the same number of times before
it is actually uninstalled.Copyright © 2009–2018 FuseSource, Corp.. All rights reserved.