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 anExpandingCharAppender
a the default value to return when no characters have been accumulated.ExpandingCharAppender
(String emptyValue, int whitespaceRangeStart) Creates anExpandingCharAppender
a the default value to return when no characters have been accumulated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(char ch) Appends the given character.final void
append
(char[] ch, int from, int length) Appends characters from an input arrayfinal void
append
(DefaultCharAppender appender) Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace charactersfinal void
Appends the contents of a String to this appendervoid
appendIgnoringPadding
(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.)void
appendIgnoringWhitespace
(char ch) Appends the given character and marks it as ignored if it is a whitespace (ch <= ' '
)void
appendIgnoringWhitespaceAndPadding
(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 char
appendUntil
(char ch, CharInput input, char stop) Appends characters from the input, until a stop character is foundfinal char
appendUntil
(char ch, CharInput input, char stop1, char stop2) Appends characters from the input, until a stop character is foundfinal char
appendUntil
(char ch, CharInput input, char stop1, char stop2, char stop3) Appends characters from the input, until a stop character is found(package private) final void
expand()
(package private) final void
expand
(int additionalLength) private void
expand
(int additionalLength, double factor) (package private) final void
final void
fill
(char ch, int length) Adds a sequence of repeated characters to the input.final void
prepend
(char ch) Prepends the current accumulated value with a characterfinal void
prepend
(char[] chars) Prepends the current accumulated value a sequence of charactersfinal void
prepend
(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, 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
-
MAX_ARRAY_LENGTH
private static final int MAX_ARRAY_LENGTH- See Also:
-
-
Constructor Details
-
ExpandingCharAppender
Creates anExpandingCharAppender
a 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 anExpandingCharAppender
a 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:CharAppender
Appends the given character and marks it as ignored if it is a whitespace (ch <= ' '
)- Specified by:
appendIgnoringWhitespace
in interfaceCharAppender
- Overrides:
appendIgnoringWhitespace
in classDefaultCharAppender
- Parameters:
ch
- character to append
-
appendIgnoringPadding
public void appendIgnoringPadding(char ch, char padding) Description copied from interface:CharAppender
Appends 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:
appendIgnoringPadding
in interfaceCharAppender
- Overrides:
appendIgnoringPadding
in classDefaultCharAppender
- Parameters:
ch
- character to appendpadding
- the padding character to ignore
-
appendIgnoringWhitespaceAndPadding
public void appendIgnoringWhitespaceAndPadding(char ch, char padding) Description copied from interface:CharAppender
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.)- Specified by:
appendIgnoringWhitespaceAndPadding
in interfaceCharAppender
- Overrides:
appendIgnoringWhitespaceAndPadding
in classDefaultCharAppender
- Parameters:
ch
- character to appendpadding
- the padding character to ignore
-
append
public void append(char ch) Description copied from interface:CharAppender
Appends the given character.- Specified by:
append
in interfaceCharAppender
- Overrides:
append
in classDefaultCharAppender
- Parameters:
ch
- the character to append
-
fill
public final void fill(char ch, int length) Description copied from interface:CharAppender
Adds a sequence of repeated characters to the input.- Specified by:
fill
in interfaceCharAppender
- Overrides:
fill
in 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:DefaultCharAppender
Prepends the current accumulated value with a character- Specified by:
prepend
in interfaceCharAppender
- Overrides:
prepend
in 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:CharAppender
Prepends the current accumulated value with a couple of characters- Specified by:
prepend
in interfaceCharAppender
- Overrides:
prepend
in 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:CharAppender
Prepends the current accumulated value a sequence of characters- Specified by:
prepend
in interfaceCharAppender
- Overrides:
prepend
in classDefaultCharAppender
- Parameters:
chars
- the character sequence to prepend in front of the current accumulated value.
-
append
Description copied from class:DefaultCharAppender
Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace characters- Overrides:
append
in classDefaultCharAppender
- Parameters:
appender
- The DefaultCharAppender instance got get contents from.
-
appendUntil
Description copied from interface:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Overrides:
appendUntil
in 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:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Overrides:
appendUntil
in 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:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Overrides:
appendUntil
in 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:CharAppender
Appends characters from an input array- Specified by:
append
in interfaceCharAppender
- Overrides:
append
in 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:CharAppender
Appends the contents of a String to this appender- Specified by:
append
in interfaceCharAppender
- Overrides:
append
in 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
-