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
,java.lang.CharSequence
public class ElasticCharAppender extends ExpandingCharAppender
A character appender that restores its internal buffer size after expanding to accommodate larger contents.
-
-
Field Summary
Fields Modifier and Type Field Description private int
defaultLength
private static char[]
EMPTY_CHAR_ARRAY
-
Fields inherited from class com.univocity.parsers.common.input.DefaultCharAppender
chars, emptyChars, emptyValue, index, whitespaceCount, whitespaceRangeStart
-
-
Constructor Summary
Constructors Constructor Description ElasticCharAppender(int defaultLength, java.lang.String emptyValue)
ElasticCharAppender(java.lang.String emptyValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAndReset()
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)
char[]
getCharsAndReset()
Returns the accumulated characters, discarding any trailing whitespace characters identified when usingDefaultCharAppender.appendIgnoringWhitespace(char)
,DefaultCharAppender.appendIgnoringPadding(char, char)
orDefaultCharAppender.appendIgnoringWhitespaceAndPadding(char, char)
char[]
getTrimmedCharsAndReset()
java.lang.String
getTrimmedStringAndReset()
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
-
-
-
-
Method Detail
-
getAndReset
public java.lang.String 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
public java.lang.String getTrimmedStringAndReset()
-
getTrimmedCharsAndReset
public char[] getTrimmedCharsAndReset()
-
-