Class ExpandingCharAppender
java.lang.Object
com.univocity.parsers.common.input.DefaultCharAppender
com.univocity.parsers.common.input.ExpandingCharAppender
- All Implemented Interfaces:
CharAppender,CharSequence
- Direct Known Subclasses:
ElasticCharAppender,WriterCharAppender
An implementation
CharAppender that expands the internal buffer of characters as required.-
Field Summary
FieldsFields inherited from class com.univocity.parsers.common.input.DefaultCharAppender
chars, emptyChars, emptyValue, index, whitespaceCount, whitespaceRangeStart -
Constructor Summary
ConstructorsConstructorDescriptionExpandingCharAppender(int initialBufferLength, String emptyValue, int whitespaceRangeStart) Creates anExpandingCharAppendera the default value to return when no characters have been accumulated.ExpandingCharAppender(String emptyValue, int whitespaceRangeStart) Creates anExpandingCharAppendera the default value to return when no characters have been accumulated. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(char ch) Appends the given character.final voidappend(char[] ch, int from, int length) Appends characters from an input arrayfinal voidappend(DefaultCharAppender appender) Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace charactersfinal voidAppends the contents of a String to this appendervoidappendIgnoringPadding(char ch, char padding) Appends the given character and marks it as ignored if it is a padding character (the definition of a padding character is implementation dependent.)voidappendIgnoringWhitespace(char ch) Appends the given character and marks it as ignored if it is a whitespace (ch <= ' ')voidappendIgnoringWhitespaceAndPadding(char ch, char padding) Appends the given character and marks it as ignored if it is a whitespace (ch <= ' ') or a padding character (the definition of a padding character is implementation dependent.)final charappendUntil(char ch, CharInput input, char stop) Appends characters from the input, until a stop character is foundfinal charappendUntil(char ch, CharInput input, char stop1, char stop2) Appends characters from the input, until a stop character is foundfinal charappendUntil(char ch, CharInput input, char stop1, char stop2, char stop3) Appends characters from the input, until a stop character is found(package private) final voidexpand()(package private) final voidexpand(int additionalLength) private voidexpand(int additionalLength, double factor) (package private) final voidfinal voidfill(char ch, int length) Adds a sequence of repeated characters to the input.final voidprepend(char ch) Prepends the current accumulated value with a characterfinal voidprepend(char[] chars) Prepends the current accumulated value a sequence of charactersfinal voidprepend(char ch1, char ch2) Prepends the current accumulated value with a couple of charactersMethods inherited from class com.univocity.parsers.common.input.DefaultCharAppender
append, append, append, append, append, charAt, delete, getAndReset, getChars, getCharsAndReset, ignore, indexOf, indexOf, indexOf, indexOfAny, isEmpty, lastIndexOf, length, remove, reset, resetWhitespaceCount, subSequence, substring, toString, updateWhitespace, whitespaceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints
-
Field Details
-
MAX_ARRAY_LENGTH
private static final int MAX_ARRAY_LENGTH- See Also:
-
-
Constructor Details
-
ExpandingCharAppender
Creates anExpandingCharAppendera the default value to return when no characters have been accumulated. The padding character is defaulted to a whitespace character ' '.- Parameters:
emptyValue- default value to return when no characters have been accumulatedwhitespaceRangeStart- starting range of characters considered to be whitespace.
-
ExpandingCharAppender
Creates anExpandingCharAppendera the default value to return when no characters have been accumulated. The padding character is defaulted to a whitespace character ' '.- Parameters:
initialBufferLength- the initial length of the internal buffer.emptyValue- default value to return when no characters have been accumulatedwhitespaceRangeStart- starting range of characters considered to be whitespace.
-
-
Method Details
-
appendIgnoringWhitespace
public void appendIgnoringWhitespace(char ch) Description copied from interface:CharAppenderAppends the given character and marks it as ignored if it is a whitespace (ch <= ' ')- Specified by:
appendIgnoringWhitespacein interfaceCharAppender- Overrides:
appendIgnoringWhitespacein classDefaultCharAppender- Parameters:
ch- character to append
-
appendIgnoringPadding
public void appendIgnoringPadding(char ch, char padding) Description copied from interface:CharAppenderAppends the given character and marks it as ignored if it is a padding character (the definition of a padding character is implementation dependent.)- Specified by:
appendIgnoringPaddingin interfaceCharAppender- Overrides:
appendIgnoringPaddingin classDefaultCharAppender- Parameters:
ch- character to appendpadding- the padding character to ignore
-
appendIgnoringWhitespaceAndPadding
public void appendIgnoringWhitespaceAndPadding(char ch, char padding) Description copied from interface:CharAppenderAppends the given character and marks it as ignored if it is a whitespace (ch <= ' ') or a padding character (the definition of a padding character is implementation dependent.)- Specified by:
appendIgnoringWhitespaceAndPaddingin interfaceCharAppender- Overrides:
appendIgnoringWhitespaceAndPaddingin classDefaultCharAppender- Parameters:
ch- character to appendpadding- the padding character to ignore
-
append
public void append(char ch) Description copied from interface:CharAppenderAppends the given character.- Specified by:
appendin interfaceCharAppender- Overrides:
appendin classDefaultCharAppender- Parameters:
ch- the character to append
-
fill
public final void fill(char ch, int length) Description copied from interface:CharAppenderAdds a sequence of repeated characters to the input.- Specified by:
fillin interfaceCharAppender- Overrides:
fillin classDefaultCharAppender- Parameters:
ch- the character to appendlength- the number of times the given character should be appended.
-
expandAndRetry
final void expandAndRetry() -
expand
private void expand(int additionalLength, double factor) -
expand
final void expand() -
expand
final void expand(int additionalLength) -
prepend
public final void prepend(char ch) Description copied from class:DefaultCharAppenderPrepends the current accumulated value with a character- Specified by:
prependin interfaceCharAppender- Overrides:
prependin classDefaultCharAppender- Parameters:
ch- the character to prepend in front of the current accumulated value.
-
prepend
public final void prepend(char ch1, char ch2) Description copied from interface:CharAppenderPrepends the current accumulated value with a couple of characters- Specified by:
prependin interfaceCharAppender- Overrides:
prependin classDefaultCharAppender- Parameters:
ch1- the first character to prepend in front of the current accumulated value.ch2- the second character to prepend in front of the current accumulated value.
-
prepend
public final void prepend(char[] chars) Description copied from interface:CharAppenderPrepends the current accumulated value a sequence of characters- Specified by:
prependin interfaceCharAppender- Overrides:
prependin classDefaultCharAppender- Parameters:
chars- the character sequence to prepend in front of the current accumulated value.
-
append
Description copied from class:DefaultCharAppenderAppends the contents of another DefaultCharAppender, discarding any of its trailing whitespace characters- Overrides:
appendin classDefaultCharAppender- Parameters:
appender- The DefaultCharAppender instance got get contents from.
-
appendUntil
Description copied from interface:CharAppenderAppends characters from the input, until a stop character is found- Specified by:
appendUntilin interfaceCharAppender- Overrides:
appendUntilin classDefaultCharAppender- Parameters:
ch- the first character of the input to be appended.input- the input whose the following characters will be appendedstop- the stop character- Returns:
- the stop character found on the input.
-
appendUntil
Description copied from interface:CharAppenderAppends characters from the input, until a stop character is found- Specified by:
appendUntilin interfaceCharAppender- Overrides:
appendUntilin classDefaultCharAppender- Parameters:
ch- the first character of the input to be appended.input- the input whose the following characters will be appendedstop1- the first stop characterstop2- the second stop character- Returns:
- one of the stop characters found on the input.
-
appendUntil
Description copied from interface:CharAppenderAppends characters from the input, until a stop character is found- Specified by:
appendUntilin interfaceCharAppender- Overrides:
appendUntilin classDefaultCharAppender- Parameters:
ch- the first character of the input to be appended.input- the input whose the following characters will be appendedstop1- the first stop characterstop2- the second stop characterstop3- the third stop character- Returns:
- one of the stop characters found on the input.
-
append
public final void append(char[] ch, int from, int length) Description copied from interface:CharAppenderAppends characters from an input array- Specified by:
appendin interfaceCharAppender- Overrides:
appendin classDefaultCharAppender- Parameters:
ch- the character arrayfrom- the position of the first character in the array to be appendedlength- the number of characters to be appended from the given posiion.
-
append
Description copied from interface:CharAppenderAppends the contents of a String to this appender- Specified by:
appendin interfaceCharAppender- Overrides:
appendin classDefaultCharAppender- Parameters:
string- the string whose characters will be appended.from- the index of the first character to appendto- the index of the last character to append
-