Package org.jline.utils
Class AttributedStringBuilder
- java.lang.Object
-
- org.jline.utils.AttributedCharSequence
-
- org.jline.utils.AttributedStringBuilder
-
- All Implemented Interfaces:
java.lang.Appendable
,java.lang.CharSequence
public class AttributedStringBuilder extends AttributedCharSequence implements java.lang.Appendable
Attributed string builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AttributedStringBuilder.TabStops
-
Nested classes/interfaces inherited from class org.jline.utils.AttributedCharSequence
AttributedCharSequence.ForceMode
-
-
Field Summary
Fields Modifier and Type Field Description private char[]
buffer
private AttributedStyle
current
private int
lastLineLength
private int
length
private long[]
style
private AttributedStringBuilder.TabStops
tabs
-
Fields inherited from class org.jline.utils.AttributedCharSequence
DISABLE_ALTERNATE_CHARSET, TRUE_COLORS
-
-
Constructor Summary
Constructors Constructor Description AttributedStringBuilder()
AttributedStringBuilder(int capacity)
-
Method Summary
-
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
-
-
-
-
Field Detail
-
buffer
private char[] buffer
-
style
private long[] style
-
length
private int length
-
tabs
private AttributedStringBuilder.TabStops tabs
-
lastLineLength
private int lastLineLength
-
current
private AttributedStyle current
-
-
Method Detail
-
append
public static AttributedString append(java.lang.CharSequence... strings)
-
length
public int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfacejava.lang.CharSequence
- Overrides:
charAt
in classAttributedCharSequence
-
styleAt
public AttributedStyle styleAt(int index)
- 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
public AttributedString subSequence(int start, int end)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
- Specified by:
subSequence
in classAttributedCharSequence
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq)
- Specified by:
append
in interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq, int start, int end)
- Specified by:
append
in interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(char c)
- Specified by:
append
in interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq, AttributedStyle style)
-
style
public AttributedStringBuilder style(AttributedStyle style)
-
style
public AttributedStringBuilder style(java.util.function.Function<AttributedStyle,AttributedStyle> style)
-
styled
public AttributedStringBuilder styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.lang.CharSequence cs)
-
styled
public AttributedStringBuilder styled(AttributedStyle style, java.lang.CharSequence cs)
-
styled
public AttributedStringBuilder styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.util.function.Consumer<AttributedStringBuilder> consumer)
-
style
public AttributedStyle style()
-
append
public AttributedStringBuilder append(AttributedString str)
-
append
public AttributedStringBuilder append(AttributedString str, int start, int end)
-
append
public AttributedStringBuilder append(AttributedCharSequence str)
-
append
public AttributedStringBuilder append(AttributedCharSequence str, int start, int end)
-
ensureCapacity
protected void ensureCapacity(int nl)
-
appendAnsi
public void appendAnsi(java.lang.String ansi)
-
ansiAppend
public AttributedStringBuilder ansiAppend(java.lang.String ansi)
-
insertTab
protected void insertTab(AttributedStyle s)
-
setLength
public void setLength(int l)
-
tabs
public AttributedStringBuilder tabs(int tabsize)
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
public AttributedStringBuilder tabs(java.util.List<java.lang.Integer> tabs)
-
styleMatches
public AttributedStringBuilder styleMatches(java.util.regex.Pattern pattern, AttributedStyle s)
-
styleMatches
public AttributedStringBuilder styleMatches(java.util.regex.Pattern pattern, java.util.List<AttributedStyle> styles)
-
-