Class ElasticCharAppender
java.lang.Object
com.univocity.parsers.common.input.DefaultCharAppender
com.univocity.parsers.common.input.ExpandingCharAppender
com.univocity.parsers.common.input.ElasticCharAppender
- All Implemented Interfaces:
CharAppender
,CharSequence
A character appender that restores its internal buffer size after expanding to accommodate larger contents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final char[]
Fields inherited from class com.univocity.parsers.common.input.DefaultCharAppender
chars, emptyChars, emptyValue, index, whitespaceCount, whitespaceRangeStart
-
Constructor Summary
ConstructorsConstructorDescriptionElasticCharAppender
(int defaultLength, String emptyValue) ElasticCharAppender
(String emptyValue) -
Method Summary
Modifier and TypeMethodDescriptionReturns the accumulated value as a String, discarding any trailing whitespace characters identified when usingDefaultCharAppender.appendIgnoringWhitespace(char)
,DefaultCharAppender.appendIgnoringPadding(char, char)
orDefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char)
char[]
Returns the accumulated characters, discarding any trailing whitespace characters identified when usingDefaultCharAppender.appendIgnoringWhitespace(char)
,DefaultCharAppender.appendIgnoringPadding(char, char)
orDefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char)
char[]
void
reset()
Clears the accumulated value and the whitespace count.Methods inherited from class com.univocity.parsers.common.input.ExpandingCharAppender
append, append, append, append, appendIgnoringPadding, appendIgnoringWhitespace, appendIgnoringWhitespaceAndPadding, appendUntil, appendUntil, appendUntil, expand, expand, expandAndRetry, fill, prepend, prepend, prepend
Methods inherited from class com.univocity.parsers.common.input.DefaultCharAppender
append, append, append, append, append, charAt, delete, getChars, ignore, indexOf, indexOf, indexOf, indexOfAny, isEmpty, lastIndexOf, length, remove, resetWhitespaceCount, subSequence, substring, toString, updateWhitespace, whitespaceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
Field Details
-
EMPTY_CHAR_ARRAY
private static final char[] EMPTY_CHAR_ARRAY -
defaultLength
private int defaultLength
-
-
Constructor Details
-
ElasticCharAppender
-
ElasticCharAppender
-
-
Method Details
-
getAndReset
Description copied from class:DefaultCharAppender
Returns the accumulated value as a String, discarding any trailing whitespace characters identified when usingDefaultCharAppender.appendIgnoringWhitespace(char)
,DefaultCharAppender.appendIgnoringPadding(char, char)
orDefaultCharAppender.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.- Specified by:
getAndReset
in interfaceCharAppender
- Overrides:
getAndReset
in classDefaultCharAppender
- Returns:
- a String containing the accumulated characters without the trailing white spaces. Or the
DefaultCharAppender.emptyValue
defined in the constructor of this class.
-
getCharsAndReset
public char[] getCharsAndReset()Description copied from class:DefaultCharAppender
Returns the accumulated characters, discarding any trailing whitespace characters identified when usingDefaultCharAppender.appendIgnoringWhitespace(char)
,DefaultCharAppender.appendIgnoringPadding(char, char)
orDefaultCharAppender.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.- Specified by:
getCharsAndReset
in interfaceCharAppender
- Overrides:
getCharsAndReset
in classDefaultCharAppender
- Returns:
- a character array containing the accumulated characters without the trailing white spaces. Or the characters of the
DefaultCharAppender.emptyValue
defined in the constructor of this class.
-
reset
public void reset()Description copied from interface:CharAppender
Clears the accumulated value and the whitespace count.- Specified by:
reset
in interfaceCharAppender
- Overrides:
reset
in classDefaultCharAppender
-
getTrimmedStringAndReset
-
getTrimmedCharsAndReset
public char[] getTrimmedCharsAndReset()
-