| Modifiers | Name | Description |
|---|---|---|
static class |
IO.Verbosity |
Verbosity for simple logging: QUIET, INFO, VERBOSE, DEBUG |
| Modifiers | Name | Description |
|---|---|---|
boolean |
ansiSupported |
Whether standard output can render ANSI escape sequences, through getAnsiOut(): the IO
comes from forConsole(), JLine's Jansi is on the class path, and standard output is a
terminal (or the jansi.mode system property is force). |
PrintWriter |
err |
Preferred error output writer. |
OutputStream |
errorStream |
Raw error output stream. |
Reader |
in |
Preferred input reader. |
InputStream |
inputStream |
Raw input stream. |
PrintWriter |
out |
Preferred output writer. |
OutputStream |
outputStream |
Raw output stream. |
| Constructor and description |
|---|
IO(InputStream inputStream, OutputStream outputStream, OutputStream errorStream)Construct a new IO container, with plain writers on the given streams. |
IO()Construct a new IO container using system streams, with plain writers. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
close()Close all streams. |
|
public void |
flush()Flush both output streams. |
|
public static IO |
forConsole()Creates an IO container on the system streams whose getAnsiOut() renders ANSI escape sequences when standard output is a terminal, through JLine's Jansi AnsiConsole.
|
|
public PrintWriter |
getAnsiOut()Returns a writer on standard output that renders ANSI escape sequences, opening JLine's Jansi console on the first call. |
|
public IO.Verbosity |
getVerbosity()Returns the verbosity level. |
|
public boolean |
isDebug()Check if the verbosity level is set to Verbosity.DEBUG. |
|
public boolean |
isInfo()Check if the verbosity level is set to Verbosity.INFO. |
|
public boolean |
isQuiet()Check if the verbosity level is set to Verbosity.QUIET. |
|
public boolean |
isVerbose()Check if the verbosity level is set to Verbosity.VERBOSE. |
|
public void |
setVerbosity(IO.Verbosity verbosity)Set the verbosity level. |
|
protected PrintWriter |
tryConstructRenderWriter(OutputStream stream)Attempts to create an ANSI-aware writer for the supplied stream. |
Whether standard output can render ANSI escape sequences, through getAnsiOut(): the IO
comes from forConsole(), JLine's Jansi is on the class path, and standard output is a
terminal (or the jansi.mode system property is force). This is decided without
opening the console. out and err are always plain.
Preferred error output writer.
Raw error output stream.
Preferred input reader.
Raw input stream.
Preferred output writer.
Raw output stream.
Construct a new IO container, with plain writers on the given streams.
Construct a new IO container using system streams, with plain writers.
Close all streams.
Flush both output streams.
Creates an IO container on the system streams whose getAnsiOut() renders ANSI escape
sequences when standard output is a terminal, through JLine's Jansi AnsiConsole.
Logger colors its lines through it, and the console is opened on the first such line.
The console writes to the JVM's own standard output, not through System.out, so call
this only where System.out has not been replaced, such as in a command-line tool's
main. A host that redirects it (Ant, Gradle, an IDE) should use IO().
Returns a writer on standard output that renders ANSI escape sequences, opening JLine's Jansi console on the first call. Opening it builds JLine's system terminal, which loads JLine's native library and sends the terminal's probes, so it happens only once something is written in color.
null if ansiSupported is false, or the console
cannot render ANSI after all, or System.out has been replaced since this IO was createdReturns the verbosity level.
Check if the verbosity level is set to Verbosity.DEBUG.
For general usage, when debug output is required, it is better to use the logging facility instead.
Check if the verbosity level is set to Verbosity.INFO.
Check if the verbosity level is set to Verbosity.QUIET.
Check if the verbosity level is set to Verbosity.VERBOSE.
Set the verbosity level.
Attempts to create an ANSI-aware writer for the supplied stream.
Only the JVM's own standard output and error streams can render ANSI, through JLine's Jansi
AnsiConsole, which also enables virtual terminal processing on Windows. The console is
opened only when the stream's jansi.mode is force, or is not strip and
the JVM has a terminal, so output redirected to a file or a pipe never loads JLine.
stream - the output stream to wrapnull if ANSI support is
unavailableCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.