Package org.jline.utils
Class AttributedStringBuilder
java.lang.Object
org.jline.utils.AttributedCharSequence
org.jline.utils.AttributedStringBuilder
- All Implemented Interfaces:
Appendable
,CharSequence
Attributed string builder
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jline.utils.AttributedCharSequence
AttributedCharSequence.ForceMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate char[]
private AttributedStyle
private int
private int
private long[]
private AttributedStringBuilder.TabStops
Fields inherited from class org.jline.utils.AttributedCharSequence
DISABLE_ALTERNATE_CHARSET, TRUE_COLORS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionansiAppend
(String ansi) append
(char c) append
(CharSequence csq) static AttributedString
append
(CharSequence... strings) append
(CharSequence csq, int start, int end) append
(CharSequence csq, AttributedStyle style) append
(AttributedCharSequence str, int start, int end) append
(AttributedString str) append
(AttributedString str, int start, int end) void
appendAnsi
(String ansi) protected char[]
buffer()
char
charAt
(int index) protected void
ensureCapacity
(int nl) protected void
int
length()
protected int
offset()
void
setLength
(int l) style()
style
(Function<AttributedStyle, AttributedStyle> style) style
(AttributedStyle style) styleAt
(int index) (package private) long
styleCodeAt
(int index) styled
(Function<AttributedStyle, AttributedStyle> style, CharSequence cs) styled
(Function<AttributedStyle, AttributedStyle> style, Consumer<AttributedStringBuilder> consumer) styled
(AttributedStyle style, CharSequence cs) styleMatches
(Pattern pattern, List<AttributedStyle> styles) styleMatches
(Pattern pattern, AttributedStyle s) subSequence
(int start, int end) tabs
(int tabsize) Set the number of spaces a tab is expanded to.Methods inherited from class org.jline.utils.AttributedCharSequence
codePointAt, codePointBefore, codePointCount, columnLength, columnSplitLength, columnSplitLength, columnSubSequence, contains, isHidden, print, println, rgbColor, roundColor, roundRgbColor, runLimit, runStart, substring, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAttributedString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
buffer
private char[] buffer -
style
private long[] style -
length
private int length -
tabs
-
lastLineLength
private int lastLineLength -
current
-
-
Constructor Details
-
AttributedStringBuilder
public AttributedStringBuilder() -
AttributedStringBuilder
public AttributedStringBuilder(int capacity)
-
-
Method Details
-
append
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
- Overrides:
charAt
in classAttributedCharSequence
-
styleAt
- Specified by:
styleAt
in classAttributedCharSequence
-
styleCodeAt
long styleCodeAt(int index) - Overrides:
styleCodeAt
in classAttributedCharSequence
-
buffer
protected char[] buffer()- Specified by:
buffer
in classAttributedCharSequence
-
offset
protected int offset()- Specified by:
offset
in classAttributedCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
- Specified by:
subSequence
in classAttributedCharSequence
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
append
-
style
-
style
-
styled
public AttributedStringBuilder styled(Function<AttributedStyle, AttributedStyle> style, CharSequence cs) -
styled
-
styled
public AttributedStringBuilder styled(Function<AttributedStyle, AttributedStyle> style, Consumer<AttributedStringBuilder> consumer) -
style
-
append
-
append
-
append
-
append
-
ensureCapacity
protected void ensureCapacity(int nl) -
appendAnsi
-
ansiAppend
-
insertTab
-
setLength
public void setLength(int l) -
tabs
Set the number of spaces a tab is expanded to. Tab size cannot be changed after text has been added to prevent inconsistent indentation. If tab size is set to 0, tabs are not expanded (the default).- Parameters:
tabsize
- Spaces per tab or 0 for no tab expansion. Must be non-negative- Returns:
- this
-
tabs
-
styleMatches
-
styleMatches
-