|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectconsole.AnsiEscapeParser
public class AnsiEscapeParser
AnsiEscapeParser class wraps calls of JCFunc-library's functions in itself. Workflow: 1) create new parser with some parameters (choose parsing MODE) 2) use: - "touch()" or "matches()" for escaped sequencies' searching in input line - "parse()" for parsing escaped sequencies in input line - "processSGRparameters()" if found escaped sequence is SGR (color) function 3) user may change "on-the-fly": - parser's behaviour (ignore, remove, parse) - set of parsing sequencies 4) user cann't change "on-the-fly" parsing MODE.
| Nested Class Summary | |
|---|---|
static class |
AnsiEscapeParser.Behaviour
Behaviour class describes parser's behaviour |
| Constructor Summary | |
|---|---|
AnsiEscapeParser(java.awt.Color defFColor,
java.awt.Color defBColor)
This constructor gets parser's properties from Console's file of properties. |
|
AnsiEscapeParser(int ansi_mode,
AnsiEscapeParser.Behaviour behaviour,
CF[] func_arr,
java.awt.Color defFColor,
java.awt.Color defBColor)
Parser's state is decribed by following properties: |
|
| Method Summary | |
|---|---|
AnsiEscapeParser.Behaviour |
getBehaviour()
|
java.awt.Color |
getDefaultBColor()
|
java.awt.Color |
getDefaultFColor()
|
boolean |
isBehaviour(AnsiEscapeParser.Behaviour behaviour)
|
boolean |
matches(java.lang.String line)
|
java.util.ArrayList<Description> |
parse(java.lang.String line)
|
java.util.ArrayList<Description> |
parse(java.lang.String line,
boolean ignoreSequences)
|
javax.swing.text.SimpleAttributeSet |
processSGRparameters(int[] parameters,
javax.swing.text.SimpleAttributeSet baseAttrs)
This method is handler of only one (but most popular) function: SGR function. |
java.lang.String |
remove(java.lang.String line,
CF func)
|
java.lang.String |
removeAll(java.lang.String line)
|
void |
setBehaviour(AnsiEscapeParser.Behaviour newBehaviour)
|
void |
setDefaultBColor(java.awt.Color newColor)
|
void |
setDefaultFColor(java.awt.Color newColor)
|
void |
setFunctions(CF... cmds)
|
boolean |
touch(AnsiEscapeParser.Behaviour behaviour,
java.lang.String line)
Check two things: |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnsiEscapeParser(int ansi_mode,
AnsiEscapeParser.Behaviour behaviour,
CF[] func_arr,
java.awt.Color defFColor,
java.awt.Color defBColor)
Parser's state is decribed by following properties:
ansi_mode - - type of escaped sequencies (what kind of escaped sequencies parser processes?)behaviour - - parser's behaviour proper (what parser does with found sequencies?)func_arr - - array of processing functions (escaped sequence == ESC + function)defFColor - - default foreground color (for SGR-function)defBColor - - default background color (for SGR-function)jcfunc.Sequences.MODE_7BIT,
Usually use 7-bit mode.,
AnsiEscapeParser.Behaviour,
CF
public AnsiEscapeParser(java.awt.Color defFColor,
java.awt.Color defBColor)
This constructor gets parser's properties from Console's file of properties.
defFColor - - default foreground color (for SGR-function)defBColor - - default background color (for SGR-function)| Method Detail |
|---|
public boolean isBehaviour(AnsiEscapeParser.Behaviour behaviour)
public AnsiEscapeParser.Behaviour getBehaviour()
public java.awt.Color getDefaultFColor()
public java.awt.Color getDefaultBColor()
public boolean matches(java.lang.String line)
public java.util.ArrayList<Description> parse(java.lang.String line)
public java.util.ArrayList<Description> parse(java.lang.String line,
boolean ignoreSequences)
public java.lang.String remove(java.lang.String line,
CF func)
public java.lang.String removeAll(java.lang.String line)
public boolean touch(AnsiEscapeParser.Behaviour behaviour,
java.lang.String line)
Check two things:
behaviour - - is it the current parser's behaviour?line - - are there any matches?public void setBehaviour(AnsiEscapeParser.Behaviour newBehaviour)
public void setDefaultFColor(java.awt.Color newColor)
public void setDefaultBColor(java.awt.Color newColor)
public void setFunctions(CF... cmds)
public javax.swing.text.SimpleAttributeSet processSGRparameters(int[] parameters,
javax.swing.text.SimpleAttributeSet baseAttrs)
This method is handler of only one (but most popular) function: SGR function. SGR function controls substring's color and style. Usually text with SGR function looks like that: This is #SGR#only example#/SGR#: you'll never see tag "#SGR#" in your texts. There is used some "base" text style for whole line but under tag "#SGR#" base style is changed. Parameters:
parameters - - array of parameters; usually it is parser's working result.baseAttrs - - base text's style
Description
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||