CharAppender
, java.lang.CharSequence
WriterCharAppender
public class ExpandingCharAppender extends DefaultCharAppender
CharAppender
that expands the internal buffer of characters as required.Constructor | 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 | 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
|
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, charAt, getAndReset, getChars, getCharsAndReset, length, reset, resetWhitespaceCount, subSequence, toString, updateWhitespace, whitespaceCount
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)
CharAppender
ch <= ' '
)appendIgnoringWhitespace
in interface CharAppender
appendIgnoringWhitespace
in class DefaultCharAppender
ch
- character to appendpublic void appendIgnoringPadding(char ch, char padding)
CharAppender
appendIgnoringPadding
in interface CharAppender
appendIgnoringPadding
in class DefaultCharAppender
ch
- character to appendpadding
- the padding character to ignorepublic void appendIgnoringWhitespaceAndPadding(char ch, char padding)
CharAppender
ch <= ' '
) or a padding character (the definition of a padding character is implementation dependent.)appendIgnoringWhitespaceAndPadding
in interface CharAppender
appendIgnoringWhitespaceAndPadding
in class DefaultCharAppender
ch
- character to appendpadding
- the padding character to ignorepublic void append(char ch)
CharAppender
append
in interface CharAppender
append
in class DefaultCharAppender
ch
- the character to appendpublic final void fill(char ch, int length)
CharAppender
fill
in interface CharAppender
fill
in class DefaultCharAppender
ch
- the character to appendlength
- the number of times the given character should be appended.public final void prepend(char ch)
DefaultCharAppender
prepend
in interface CharAppender
prepend
in class DefaultCharAppender
ch
- the character to prepend in front of the current accumulated value.public final void prepend(char ch1, char ch2)
CharAppender
prepend
in interface CharAppender
prepend
in class DefaultCharAppender
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.public final void prepend(char[] chars)
CharAppender
prepend
in interface CharAppender
prepend
in class DefaultCharAppender
chars
- the character sequence to prepend in front of the current accumulated value.public final void append(DefaultCharAppender appender)
DefaultCharAppender
append
in class DefaultCharAppender
appender
- The DefaultCharAppender instance got get contents from.public final char appendUntil(char ch, CharInput input, char stop)
CharAppender
appendUntil
in interface CharAppender
appendUntil
in class DefaultCharAppender
ch
- 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)
CharAppender
appendUntil
in interface CharAppender
appendUntil
in class DefaultCharAppender
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 characterpublic final char appendUntil(char ch, CharInput input, char stop1, char stop2, char stop3)
CharAppender
appendUntil
in interface CharAppender
appendUntil
in class DefaultCharAppender
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 characterpublic final void append(char[] ch, int from, int length)
CharAppender
append
in interface CharAppender
append
in class DefaultCharAppender
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.public final void append(java.lang.String string, int from, int to)
CharAppender
append
in interface CharAppender
append
in class DefaultCharAppender
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