Class AbstractLengthLimitedStringBuilder
- java.lang.Object
-
- com.atlassian.confluence.search.v2.extractor.util.AbstractLengthLimitedStringBuilder
-
- Direct Known Subclasses:
StaticLengthLimitedStringBuilder
public abstract class AbstractLengthLimitedStringBuilder extends Object
This is a base class for string builders that limit their length.Instances of this class are not safe for use by multiple threads.
- Since:
- 8.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractLengthLimitedStringBuilder.LIMIT_BEHAVIOURBehaviour of the string builder when the limit is reached.
-
Field Summary
Fields Modifier and Type Field Description protected StringBuilderbufferprotected booleanlimitReachedprotected AbstractLengthLimitedStringBuilder.LIMIT_BEHAVIOURthrowWhenLimitReached
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AbstractLengthLimitedStringBuilderappend(char c)AbstractLengthLimitedStringBuilderappend(char[] str, int offset, int len)AbstractLengthLimitedStringBuilderappend(String s)intcapacity()booleanisLimitReached()intlength()protected abstract intlimit()protected booleanlimitReached(int length)Checks if appending length characters to the string builder will reach the limit.protected intremainingLength()voidsetLength(int l)StringtoString()
-
-
-
Field Detail
-
throwWhenLimitReached
protected final AbstractLengthLimitedStringBuilder.LIMIT_BEHAVIOUR throwWhenLimitReached
-
buffer
protected StringBuilder buffer
-
limitReached
protected boolean limitReached
-
-
Method Detail
-
setLength
public void setLength(int l)
-
length
public int length()
-
append
public AbstractLengthLimitedStringBuilder append(char[] str, int offset, int len)
-
append
public AbstractLengthLimitedStringBuilder append(char c)
-
append
public AbstractLengthLimitedStringBuilder append(String s)
-
remainingLength
protected int remainingLength()
-
limit
protected abstract int limit()
-
limitReached
protected boolean limitReached(int length)
Checks if appending length characters to the string builder will reach the limit.- Parameters:
length-- Returns:
- true if the limit is reached, false otherwise
-
capacity
public int capacity()
-
isLimitReached
public boolean isLimitReached()
-
-