public class ElasticCharAppender extends ExpandingCharAppender
Modifier and Type | Field and Description |
---|---|
private int |
defaultLength |
private static char[] |
EMPTY_CHAR_ARRAY |
chars, emptyChars, emptyValue, index, whitespaceCount, whitespaceRangeStart
Constructor and Description |
---|
ElasticCharAppender(int defaultLength,
java.lang.String emptyValue) |
ElasticCharAppender(java.lang.String emptyValue) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAndReset()
Returns the accumulated value as a String, discarding any trailing whitespace characters identified when using
DefaultCharAppender.appendIgnoringWhitespace(char) , DefaultCharAppender.appendIgnoringPadding(char, char) or DefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char) |
char[] |
getCharsAndReset()
Returns the accumulated characters, discarding any trailing whitespace characters identified when using
DefaultCharAppender.appendIgnoringWhitespace(char) , DefaultCharAppender.appendIgnoringPadding(char, char) or DefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char) |
char[] |
getTrimmedCharsAndReset() |
java.lang.String |
getTrimmedStringAndReset() |
void |
reset()
Clears the accumulated value and the whitespace count.
|
append, append, append, append, appendIgnoringPadding, appendIgnoringWhitespace, appendIgnoringWhitespaceAndPadding, appendUntil, appendUntil, appendUntil, expand, expand, expandAndRetry, fill, prepend, prepend, prepend
append, append, append, append, append, charAt, delete, getChars, ignore, indexOf, indexOf, indexOf, indexOfAny, isEmpty, lastIndexOf, length, remove, resetWhitespaceCount, subSequence, substring, toString, updateWhitespace, whitespaceCount
private static final char[] EMPTY_CHAR_ARRAY
private int defaultLength
public ElasticCharAppender(java.lang.String emptyValue)
public ElasticCharAppender(int defaultLength, java.lang.String emptyValue)
public java.lang.String getAndReset()
DefaultCharAppender
DefaultCharAppender.appendIgnoringWhitespace(char)
, DefaultCharAppender.appendIgnoringPadding(char, char)
or DefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char)
The internal accumulated value is discarded after invoking this method (as in DefaultCharAppender.reset()
)
If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the return value will be DefaultCharAppender.emptyValue
attribute defined in the constructor of this class.
getAndReset
in interface CharAppender
getAndReset
in class DefaultCharAppender
DefaultCharAppender.emptyValue
defined in the constructor of this class.public char[] getCharsAndReset()
DefaultCharAppender
DefaultCharAppender.appendIgnoringWhitespace(char)
, DefaultCharAppender.appendIgnoringPadding(char, char)
or DefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char)
The internal accumulated value is discarded after invoking this method (as in DefaultCharAppender.reset()
)
If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the return value will be character sequence of the DefaultCharAppender.emptyValue
attribute defined in the constructor of this class.
getCharsAndReset
in interface CharAppender
getCharsAndReset
in class DefaultCharAppender
DefaultCharAppender.emptyValue
defined in the constructor of this class.public void reset()
CharAppender
reset
in interface CharAppender
reset
in class DefaultCharAppender
public java.lang.String getTrimmedStringAndReset()
public char[] getTrimmedCharsAndReset()