public class ExpandingCharAppender extends DefaultCharAppender
CharAppender that expands the internal buffer of characters as required.| Modifier and Type | Field and Description |
|---|---|
private static int |
MAX_ARRAY_LENGTH |
chars, emptyChars, emptyValue, index, whitespaceCount, whitespaceRangeStart| Constructor and Description |
|---|
ExpandingCharAppender(int initialBufferLength,
java.lang.String emptyValue,
int whitespaceRangeStart)
Creates an
ExpandingCharAppender a the default value to return when no characters have been accumulated. |
ExpandingCharAppender(java.lang.String emptyValue,
int whitespaceRangeStart)
Creates an
ExpandingCharAppender a the default value to return when no characters have been accumulated. |
| Modifier and Type | Method and Description |
|---|---|
void |
append(char ch)
Appends the given character.
|
void |
append(char[] ch,
int from,
int length)
Appends characters from an input array
|
void |
append(DefaultCharAppender appender)
Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace characters
|
void |
append(java.lang.String string,
int from,
int to)
Appends the contents of a String to this appender
|
void |
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.) |
char |
appendUntil(char ch,
CharInput input,
char stop)
Appends characters from the input, until a stop character is found
|
char |
appendUntil(char ch,
CharInput input,
char stop1,
char stop2)
Appends characters from the input, until a stop character is found
|
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) void |
expand() |
(package private) void |
expand(int additionalLength) |
private void |
expand(int additionalLength,
double factor) |
(package private) void |
expandAndRetry() |
void |
fill(char ch,
int length)
Adds a sequence of repeated characters to the input.
|
void |
prepend(char ch)
Prepends the current accumulated value with a character
|
void |
prepend(char[] chars)
Prepends the current accumulated value a sequence of characters
|
void |
prepend(char ch1,
char ch2)
Prepends the current accumulated value with a couple of characters
|
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, whitespaceCountprivate static final int MAX_ARRAY_LENGTH
public ExpandingCharAppender(java.lang.String emptyValue,
int whitespaceRangeStart)
ExpandingCharAppender a the default value to return when no characters have been accumulated.
The padding character is defaulted to a whitespace character ' '.emptyValue - default value to return when no characters have been accumulatedwhitespaceRangeStart - starting range of characters considered to be whitespace.public ExpandingCharAppender(int initialBufferLength,
java.lang.String emptyValue,
int whitespaceRangeStart)
ExpandingCharAppender a the default value to return when no characters have been accumulated.
The padding character is defaulted to a whitespace character ' '.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.public void appendIgnoringWhitespace(char ch)
CharAppenderch <= ' ')appendIgnoringWhitespace in interface CharAppenderappendIgnoringWhitespace in class DefaultCharAppenderch - character to appendpublic void appendIgnoringPadding(char ch,
char padding)
CharAppenderappendIgnoringPadding in interface CharAppenderappendIgnoringPadding in class DefaultCharAppenderch - character to appendpadding - the padding character to ignorepublic void appendIgnoringWhitespaceAndPadding(char ch,
char padding)
CharAppenderch <= ' ') or a padding character (the definition of a padding character is implementation dependent.)appendIgnoringWhitespaceAndPadding in interface CharAppenderappendIgnoringWhitespaceAndPadding in class DefaultCharAppenderch - character to appendpadding - the padding character to ignorepublic void append(char ch)
CharAppenderappend in interface CharAppenderappend in class DefaultCharAppenderch - the character to appendpublic final void fill(char ch,
int length)
CharAppenderfill in interface CharAppenderfill in class DefaultCharAppenderch - the character to appendlength - the number of times the given character should be appended.final void expandAndRetry()
private void expand(int additionalLength,
double factor)
final void expand()
final void expand(int additionalLength)
public final void prepend(char ch)
DefaultCharAppenderprepend in interface CharAppenderprepend in class DefaultCharAppenderch - the character to prepend in front of the current accumulated value.public final void prepend(char ch1,
char ch2)
CharAppenderprepend in interface CharAppenderprepend in class DefaultCharAppenderch1 - 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.public final void prepend(char[] chars)
CharAppenderprepend in interface CharAppenderprepend in class DefaultCharAppenderchars - the character sequence to prepend in front of the current accumulated value.public final void append(DefaultCharAppender appender)
DefaultCharAppenderappend in class DefaultCharAppenderappender - The DefaultCharAppender instance got get contents from.public final char appendUntil(char ch,
CharInput input,
char stop)
CharAppenderappendUntil in interface CharAppenderappendUntil in class DefaultCharAppenderch - the first character of the input to be appended.input - the input whose the following characters will be appendedstop - the stop characterpublic final char appendUntil(char ch,
CharInput input,
char stop1,
char stop2)
CharAppenderappendUntil in interface CharAppenderappendUntil in class DefaultCharAppenderch - 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 characterpublic final char appendUntil(char ch,
CharInput input,
char stop1,
char stop2,
char stop3)
CharAppenderappendUntil in interface CharAppenderappendUntil in class DefaultCharAppenderch - 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 characterpublic final void append(char[] ch,
int from,
int length)
CharAppenderappend in interface CharAppenderappend in class DefaultCharAppenderch - 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.public final void append(java.lang.String string,
int from,
int to)
CharAppenderappend in interface CharAppenderappend in class DefaultCharAppenderstring - the string whose characters will be appended.from - the index of the first character to appendto - the index of the last character to append