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[]
altIn
private char[]
altOut
private char[]
buffer
private AttributedStyle
current
private boolean
inAltCharset
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributedStringBuilder
altCharset(java.lang.String altIn, java.lang.String altOut)
AttributedStringBuilder
ansiAppend(java.lang.String ansi)
AttributedStringBuilder
append(char c)
AttributedStringBuilder
append(java.lang.CharSequence csq)
static AttributedString
append(java.lang.CharSequence... strings)
AttributedStringBuilder
append(java.lang.CharSequence csq, int start, int end)
AttributedStringBuilder
append(java.lang.CharSequence csq, AttributedStyle style)
AttributedStringBuilder
append(AttributedCharSequence str)
AttributedStringBuilder
append(AttributedCharSequence str, int start, int end)
AttributedStringBuilder
append(AttributedString str)
AttributedStringBuilder
append(AttributedString str, int start, int end)
void
appendAnsi(java.lang.String ansi)
protected char[]
buffer()
char
charAt(int index)
protected void
ensureCapacity(int nl)
private static boolean
equals(char[] a, int aFromIndex, char[] b, int bFromIndex, int length)
protected void
insertTab(AttributedStyle s)
int
length()
protected int
offset()
void
setLength(int l)
AttributedStyle
style()
AttributedStringBuilder
style(java.util.function.Function<AttributedStyle,AttributedStyle> style)
AttributedStringBuilder
style(AttributedStyle style)
AttributedStyle
styleAt(int index)
(package private) long
styleCodeAt(int index)
AttributedStringBuilder
styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.lang.CharSequence cs)
AttributedStringBuilder
styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.util.function.Consumer<AttributedStringBuilder> consumer)
AttributedStringBuilder
styled(AttributedStyle style, java.lang.CharSequence cs)
AttributedStringBuilder
styleMatches(java.util.regex.Pattern pattern, java.util.List<AttributedStyle> styles)
AttributedStringBuilder
styleMatches(java.util.regex.Pattern pattern, AttributedStyle s)
AttributedString
subSequence(int start, int end)
AttributedStringBuilder
tabs(int tabsize)
Set the number of spaces a tab is expanded to.AttributedStringBuilder
tabs(java.util.List<java.lang.Integer> tabs)
-
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
-
altIn
private char[] altIn
-
altOut
private char[] altOut
-
inAltCharset
private boolean inAltCharset
-
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)
-
equals
private static boolean equals(char[] a, int aFromIndex, char[] b, int bFromIndex, int length)
-
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)
-
altCharset
public AttributedStringBuilder altCharset(java.lang.String altIn, java.lang.String altOut)
-
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)
-
-