Package org.fusesource.jansi.io
Class AnsiOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.fusesource.jansi.io.AnsiOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
A ANSI print stream extracts ANSI escape codes written to
an output stream and calls corresponding
AnsiProcessor.process*
methods.
This particular class is not synchronized for improved performances.
For more information about ANSI escape codes, see Wikipedia article
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnsiProcessor
private static final int
private final byte[]
private final AnsiColors
private final Charset
private static final int
private final AnsiOutputStream.IoRunnable
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private AnsiMode
private int
private final AnsiProcessor
static final byte[]
private boolean
private static final int
private static final int
private static final int
private static final int
private static final int
private int
private int
private final AnsiType
private final AnsiOutputStream.IoRunnable
private final AnsiOutputStream.WidthSupplier
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorsConstructorDescriptionAnsiOutputStream
(OutputStream os, AnsiOutputStream.WidthSupplier width, AnsiMode mode, AnsiProcessor processor, AnsiType type, AnsiColors colors, Charset cs, AnsiOutputStream.IoRunnable installer, AnsiOutputStream.IoRunnable uninstaller, boolean resetAtUninstall) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getMode()
int
getType()
void
install()
boolean
private void
private void
processEscapeCommand
(int data) private void
private void
reset
(boolean skipBuffer) Resets all state to continue with regular parsingvoid
void
setResetAtUninstall
(boolean resetAtUninstall) void
void
write
(int data) Methods inherited from class java.io.FilterOutputStream
flush, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
RESET_CODE
public static final byte[] RESET_CODE -
LOOKING_FOR_FIRST_ESC_CHAR
private static final int LOOKING_FOR_FIRST_ESC_CHAR- See Also:
-
LOOKING_FOR_SECOND_ESC_CHAR
private static final int LOOKING_FOR_SECOND_ESC_CHAR- See Also:
-
LOOKING_FOR_NEXT_ARG
private static final int LOOKING_FOR_NEXT_ARG- See Also:
-
LOOKING_FOR_STR_ARG_END
private static final int LOOKING_FOR_STR_ARG_END- See Also:
-
LOOKING_FOR_INT_ARG_END
private static final int LOOKING_FOR_INT_ARG_END- See Also:
-
LOOKING_FOR_OSC_COMMAND
private static final int LOOKING_FOR_OSC_COMMAND- See Also:
-
LOOKING_FOR_OSC_COMMAND_END
private static final int LOOKING_FOR_OSC_COMMAND_END- See Also:
-
LOOKING_FOR_OSC_PARAM
private static final int LOOKING_FOR_OSC_PARAM- See Also:
-
LOOKING_FOR_ST
private static final int LOOKING_FOR_ST- See Also:
-
LOOKING_FOR_CHARSET
private static final int LOOKING_FOR_CHARSET- See Also:
-
FIRST_ESC_CHAR
private static final int FIRST_ESC_CHAR- See Also:
-
SECOND_ESC_CHAR
private static final int SECOND_ESC_CHAR- See Also:
-
SECOND_OSC_CHAR
private static final int SECOND_OSC_CHAR- See Also:
-
BEL
private static final int BEL- See Also:
-
SECOND_ST_CHAR
private static final int SECOND_ST_CHAR- See Also:
-
SECOND_CHARSET0_CHAR
private static final int SECOND_CHARSET0_CHAR- See Also:
-
SECOND_CHARSET1_CHAR
private static final int SECOND_CHARSET1_CHAR- See Also:
-
ap
-
MAX_ESCAPE_SEQUENCE_LENGTH
private static final int MAX_ESCAPE_SEQUENCE_LENGTH- See Also:
-
buffer
private final byte[] buffer -
pos
private int pos -
startOfValue
private int startOfValue -
options
-
state
private int state -
cs
-
width
-
processor
-
type
-
colors
-
installer
-
uninstaller
-
mode
-
resetAtUninstall
private boolean resetAtUninstall
-
-
Constructor Details
-
AnsiOutputStream
public AnsiOutputStream(OutputStream os, AnsiOutputStream.WidthSupplier width, AnsiMode mode, AnsiProcessor processor, AnsiType type, AnsiColors colors, Charset cs, AnsiOutputStream.IoRunnable installer, AnsiOutputStream.IoRunnable uninstaller, boolean resetAtUninstall)
-
-
Method Details
-
getTerminalWidth
public int getTerminalWidth() -
getType
-
getColors
-
getMode
-
setMode
-
isResetAtUninstall
public boolean isResetAtUninstall() -
setResetAtUninstall
public void setResetAtUninstall(boolean resetAtUninstall) -
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
processCharsetSelect
- Throws:
IOException
-
processOperatingSystemCommand
- Throws:
IOException
-
processEscapeCommand
- Throws:
IOException
-
reset
Resets all state to continue with regular parsing- Parameters:
skipBuffer
- if current buffer should be skipped or written to out- Throws:
IOException
-
install
- Throws:
IOException
-
uninstall
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-