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 interfacestatic interfacestatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnsiProcessorprivate static final intprivate final byte[]private final AnsiColorsprivate final Charsetprivate static final intprivate final AnsiOutputStream.IoRunnableprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate AnsiModeprivate intprivate final AnsiProcessorstatic final byte[]private booleanprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intprivate intprivate final AnsiTypeprivate final AnsiOutputStream.IoRunnableprivate final AnsiOutputStream.WidthSupplierFields 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 TypeMethodDescriptionvoidclose()getMode()intgetType()voidinstall()booleanprivate voidprivate voidprocessEscapeCommand(int data) private voidprivate voidreset(boolean skipBuffer) Resets all state to continue with regular parsingvoidvoidsetResetAtUninstall(boolean resetAtUninstall) voidvoidwrite(int data) Methods inherited from class java.io.FilterOutputStream
flush, write, writeMethods 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:
writein 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-