Calls to CharAppender#appendIgnoringWhitespace(char), CharAppender#appendIgnoringPadding(char, char) and CharAppender#appendIgnoringWhitespaceAndPadding(char, char) should accumulate the
given character and only discard whitespaces/padding if no non-whitespace is appended:
For example:
append('a'); // accumulated value is now "a"; whitespaceCount = 0;
appendIgnoringWhitespace('b'); // accumulated value is now "ab"; whitespaceCount = 0;
appendIgnoringWhitespace(' '); // accumulated value remains "ab"; whitespaceCount = 1;
appendIgnoringWhitespace(' '); // accumulated value remains "ab"; whitespaceCount = 2;
appendIgnoringWhitespace('c'); // accumulated value is now "ab c"; whitespaceCount = 0;
appendIgnoringWhitespace(' '); // accumulated value remains "ab c"; whitespaceCount = 1;
appendIgnoringWhitespace('d'); // accumulated value is now "ab c d"; whitespaceCount = 0;
append(' '); // accumulated value is now "ab c d "; whitespaceCount = 0;
Implementation Note
White spaces should be identified as any character <= ' '
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | append(char[]
the character array ch, int the position of the first character in the array to be appended from, int the number of characters to be appended from the given posiion. length)Appends characters from an input array |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | appendIgnoringPadding(char
character to append ch, char the padding character to ignore 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.) |
| public void | appendIgnoringWhitespace(char
character to append ch)Appends the given character and marks it as ignored if it is a whitespace ( |
| public void | appendIgnoringWhitespaceAndPadding(char
character to append ch, char the padding character to ignore padding)Appends the given character and marks it as ignored if it is a whitespace ( |
| public char | Returns: the stop character found on the input.the first character of the input to be appended. ch, CharInput the input whose the following characters will be appended input, char the stop character stop)Appends characters from the input, until a stop character is found |
| public char | Returns: one of the stop characters found on the input.the first character of the input to be appended. ch, CharInput the input whose the following characters will be appended input, char the first stop character stop1, char the second stop character stop2)Appends characters from the input, until a stop character is found |
| public char | Returns: one of the stop characters found on the input.the first character of the input to be appended. ch, CharInput the input whose the following characters will be appended input, char the first stop character stop1, char the second stop character stop2, char the third stop character stop3)Appends characters from the input, until a stop character is found |
| public void | delete(int
the number of characters to delete. count)Deletes a given number of characters from the end of the appended content. |
| public void | fill(char
the character to append ch, int the number of times the given character should be appended. length)Adds a sequence of repeated characters to the input. |
| public String | Returns: a String containing the accumulated characters without the trailing whitespaces.Returns the accumulated value as a String, discarding any trailing whitespace characters identified when using The internal accumulated value is discarded after invoking this method (as in |
| public char[] | |
| public char[] | Returns: a character array containing the accumulated characters without the trailing whitespaces.Returns the accumulated characters, discarding any trailing whitespace characters identified when using The internal accumulated value is discarded after invoking this method (as in |
| public void | ignore(int
the number of characters to ignore count)Ignores the given number of characters at the end of the appended content, effectively marking these as whitespace. |
| public int | Returns: the position of the given character in the appended content,-1 if not foundthe character to look for ch, int the starting index from where the search will begin. from)Returns first the position of a given character |
| public int | Returns: the position of the given character sequence in the appended content,-1 if not foundthe character sequence to look for charSequence, int the starting index from where the search will begin. from)Returns first the position of a given character sequence |
| public int | Returns: the position of the given character sequence in the appended content,-1 if not foundthe character sequence to look for charSequence, int the starting index from where the search will begin. from)Returns first the position of a given character sequence |
| public int | Returns: the position any one of the given characters in the appended content,-1 if none foundthe characters to look for chars, int the starting index from where the search will begin. from)Returns the first position of any given character |
| public boolean | isEmpty()
Redeclares as abstract: java. String.
|
| public int | Returns: the last position of the given character in the appended content, or-1 if not found.the character to look for ch)Returns the last index of a given character in the current appended (characters that have been marked as whitespace will be ignored) |
| public int | Returns: the current accumulated value length (the sum of all appended characters - whitespaceCount).Redeclares java. |
| public void | prepend(char
the character to prepend in front of the current accumulated value. ch)Prepends the current accumulated value with a character |
| public void | prepend(char
the first character to prepend in front of the current accumulated value. ch1, char the second character to prepend in front of the current accumulated value. ch2)Prepends the current accumulated value with a couple of characters |
| public void | prepend(char[]
the character sequence to prepend in front of the current accumulated value. chars)Prepends the current accumulated value a sequence of characters |
| public void | remove(int
the starting position in the buffer (inclusive) from, int the number of characters to accumulate from the given start position length)Removes a section from the appended content |
| public void | |
| public void | resetWhitespaceCount()
Resets the number of whitespaces accumulated after the last non-whitespace character. |
| public String | Returns: aString with the section of characters accumulated by this appender.the starting position in the buffer from, int the number of characters to accumulate from the given start position length)Returns a section of the appended content |
| public void | updateWhitespace()
Updates the internal whitespace count of this appender to trim trailing whitespaces. |
| public int | Returns: the number of whitespaces accumulated usingCharAppender#appendIgnoringWhitespace(char), CharAppender#appendIgnoringPadding(char, char) or CharAppender#appendIgnoringWhitespaceAndPadding(char, char)Returns the current number of whitespaces accumulated after the last non-whitespace character. |
| append | back to summary |
|---|---|
| public void append(char ch) Appends the given character.
| |
| append | back to summary |
|---|---|
| public void append(int ch) Appends the given codepoint.
| |
| append | back to summary |
|---|---|
| public void append(Object obj) Appends the
| |
| append | back to summary |
|---|---|
| public void append(char[] ch, int from, int length) Appends characters from an input array
| |
| append | back to summary |
|---|---|
| public void append(char[] ch) Appends characters from an input array
| |
| append | back to summary |
|---|---|
| public void append(int[] ch) Appends codepoints from an input array
| |
| append | back to summary |
|---|---|
| public void append(String string) Appends characters from an input
| |
| append | back to summary |
|---|---|
| public void append(String string, int from, int to) Appends the contents of a String to this appender
| |
| appendIgnoringPadding | back to summary |
|---|---|
| public 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.)
| |
| appendIgnoringWhitespace | back to summary |
|---|---|
| public void appendIgnoringWhitespace(char ch) Appends the given character and marks it as ignored if it is a whitespace (
| |
| appendIgnoringWhitespaceAndPadding | back to summary |
|---|---|
| public void appendIgnoringWhitespaceAndPadding(char ch, char padding) Appends the given character and marks it as ignored if it is a whitespace (
| |
| appendUntil | back to summary |
|---|---|
| public char appendUntil(char ch, CharInput input, char stop) Appends characters from the input, until a stop character is found
| |
| appendUntil | back to summary |
|---|---|
| public char appendUntil(char ch, CharInput input, char stop1, char stop2) Appends characters from the input, until a stop character is found
| |
| appendUntil | back to summary |
|---|---|
| public char appendUntil(char ch, CharInput input, char stop1, char stop2, char stop3) Appends characters from the input, until a stop character is found
| |
| delete | back to summary |
|---|---|
| public void delete(int count) Deletes a given number of characters from the end of the appended content.
Will reset the internal whitespace count if any. Invoke
| |
| fill | back to summary |
|---|---|
| public void fill(char ch, int length) Adds a sequence of repeated characters to the input.
| |
| getAndReset | back to summary |
|---|---|
| public String getAndReset() Returns the accumulated value as a String, discarding any trailing whitespace characters identified when using The internal accumulated value is discarded after invoking this method (as in
| |
| getChars | back to summary |
|---|---|
| public char[] getChars() Returns the internal character array.
| |
| getCharsAndReset | back to summary |
|---|---|
| public char[] getCharsAndReset() Returns the accumulated characters, discarding any trailing whitespace characters identified when using The internal accumulated value is discarded after invoking this method (as in
| |
| ignore | back to summary |
|---|---|
| public void ignore(int count) Ignores the given number of characters at the end of the appended content,
effectively marking these as whitespace. Invoking
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(char ch, int from) Returns first the position of a given character
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(char[] charSequence, int from) Returns first the position of a given character sequence
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(CharSequence charSequence, int from) Returns first the position of a given character sequence
| |
| indexOfAny | back to summary |
|---|---|
| public int indexOfAny(char[] chars, int from) Returns the first position of any given character
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Redeclares as abstract: java. Indicates whether this appender represents an empty
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(char ch) Returns the last index of a given character in the current appended (characters that have been marked as whitespace will be ignored)
| |
| length | back to summary |
|---|---|
| public int length() Redeclares java. Returns the current accumulated value length (the sum of all appended characters - whitespaceCount).
| |
| prepend | back to summary |
|---|---|
| public void prepend(char ch) Prepends the current accumulated value with a character
| |
| prepend | back to summary |
|---|---|
| public void prepend(char ch1, char ch2) Prepends the current accumulated value with a couple of characters
| |
| prepend | back to summary |
|---|---|
| public void prepend(char[] chars) Prepends the current accumulated value a sequence of characters
| |
| remove | back to summary |
|---|---|
| public void remove(int from, int length) Removes a section from the appended content
| |
| reset | back to summary |
|---|---|
| public void reset() Clears the accumulated value and the whitespace count. | |
| resetWhitespaceCount | back to summary |
|---|---|
| public void resetWhitespaceCount() Resets the number of whitespaces accumulated after the last non-whitespace character. This is the number of whitespaces accumulated using A subsequent call to | |
| substring | back to summary |
|---|---|
| public String substring(int from, int length) Returns a section of the appended content
| |
| updateWhitespace | back to summary |
|---|---|
| public void updateWhitespace() Updates the internal whitespace count of this appender to trim trailing whitespaces. | |
| whitespaceCount | back to summary |
|---|---|
| public int whitespaceCount() Returns the current number of whitespaces accumulated after the last non-whitespace character. This is the number of whitespaces accumulated using
| |