Class AbstractLengthLimitedStringBuilder
java.lang.Object
com.atlassian.confluence.search.v2.extractor.util.AbstractLengthLimitedStringBuilder
- Direct Known Subclasses:
StaticLengthLimitedStringBuilder
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 ClassesModifier and TypeClassDescriptionstatic enumBehaviour of the string builder when the limit is reached. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuilderprotected booleanprotected final AbstractLengthLimitedStringBuilder.LIMIT_BEHAVIOUR -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(char[] str, int offset, int len) intcapacity()booleanintlength()protected abstract intlimit()protected booleanlimitReached(int length) Checks if appending length characters to the string builder will reach the limit.protected intvoidsetLength(int l) toString()
-
Field Details
-
throwWhenLimitReached
-
buffer
-
limitReached
protected boolean limitReached
-
-
Method Details
-
setLength
public void setLength(int l) -
length
public int length() -
append
-
append
-
append
-
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
-
toString
-
capacity
public int capacity() -
isLimitReached
public boolean isLimitReached()
-