|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.common.input.DefaultCharAppender
public class DefaultCharAppender
Default implementation of the CharAppender interface
| Constructor Summary | |
|---|---|
DefaultCharAppender(int maxLength,
String emptyValue,
int whitespaceRangeStart)
Creates a DefaultCharAppender with a maximum limit of characters to append and the default value to return when no characters have been accumulated. |
|
| Method Summary | |
|---|---|
void |
append(char ch)
Appends the given character. |
void |
append(char[] ch)
Appends characters from an input array |
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(int ch)
Appends the given codepoint. |
void |
append(int[] ch)
Appends codepoints from an input array |
void |
append(String string)
Appends characters from an input String |
void |
append(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 |
char |
charAt(int i)
|
void |
fill(char ch,
int length)
Adds a sequence of repeated characters to the input. |
String |
getAndReset()
Returns the accumulated value as a String, discarding any trailing whitespace characters identified when using appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char) |
char[] |
getChars()
Returns the internal character array. |
char[] |
getCharsAndReset()
Returns the accumulated characters, discarding any trailing whitespace characters identified when using appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char) |
int |
length()
Returns the current accumulated value length (the sum of all appended characters - whitespaceCount). |
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 |
void |
reset()
Clears the accumulated value and the whitespace count. |
void |
resetWhitespaceCount()
Resets the number of whitespaces accumulated after the last non-whitespace character. |
String |
subSequence(int from,
int to)
|
String |
toString()
Returns the accumulated value as a String, discarding any trailing whitespace characters identified when using appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char) |
void |
updateWhitespace()
Updates the internal whitespace count of this appender to trim trailing whitespaces. |
int |
whitespaceCount()
Returns the current number of whitespaces accumulated after the last non-whitespace character. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultCharAppender(int maxLength,
String emptyValue,
int whitespaceRangeStart)
maxLength - maximum limit of characters to appendemptyValue - default value to return when no characters have been accumulatedwhitespaceRangeStart - starting range of characters considered to be whitespace.| Method Detail |
|---|
public void appendIgnoringPadding(char ch,
char padding)
CharAppender
appendIgnoringPadding in interface CharAppenderch - character to appendpadding - the padding character to ignore
public void appendIgnoringWhitespaceAndPadding(char ch,
char padding)
CharAppenderch <= ' ') or a padding character (the definition of a padding character is implementation dependent.)
appendIgnoringWhitespaceAndPadding in interface CharAppenderch - character to appendpadding - the padding character to ignorepublic void appendIgnoringWhitespace(char ch)
CharAppenderch <= ' ')
appendIgnoringWhitespace in interface CharAppenderch - character to appendpublic void append(char ch)
CharAppender
append in interface CharAppenderch - the character to appendpublic final void append(int ch)
CharAppender
append in interface CharAppenderch - the codepoint to appendpublic final void append(int[] ch)
CharAppender
append in interface CharAppenderch - the codepoint arraypublic String getAndReset()
appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char)
The internal accumulated value is discarded after invoking this method (as in reset())
If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the return value will be emptyValue attribute defined in the constructor of this class.
getAndReset in interface CharAppenderemptyValue defined in the constructor of this class.public final String toString()
appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char)
Does not discard the accumulated value.
If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the return value will be emptyValue attribute defined in the constructor of this class.
toString in interface CharSequencetoString in class ObjectemptyValue defined in the constructor of this class.public final int length()
CharAppender
length in interface CharAppenderlength in interface CharSequencepublic char[] getCharsAndReset()
appendIgnoringWhitespace(char), appendIgnoringPadding(char, char) or appendIgnoringWhitespaceAndPadding(char, char)
The internal accumulated value is discarded after invoking this method (as in reset())
If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the return value will be character sequence of the emptyValue attribute defined in the constructor of this class.
getCharsAndReset in interface CharAppenderemptyValue defined in the constructor of this class.public final int whitespaceCount()
CharAppender This is the number of whitespaces accumulated using CharAppender.appendIgnoringWhitespace(char), CharAppender.appendIgnoringPadding(char, char) or CharAppender.appendIgnoringWhitespaceAndPadding(char, char)
whitespaceCount in interface CharAppenderCharAppender.appendIgnoringWhitespace(char), CharAppender.appendIgnoringPadding(char, char) or CharAppender.appendIgnoringWhitespaceAndPadding(char, char)public void reset()
CharAppender
reset in interface CharAppenderpublic void append(DefaultCharAppender appender)
appender - The DefaultCharAppender instance got get contents from.public final void resetWhitespaceCount()
CharAppender This is the number of whitespaces accumulated using CharAppender.appendIgnoringWhitespace(char), CharAppender.appendIgnoringPadding(char, char) or CharAppender.appendIgnoringWhitespaceAndPadding(char, char)
A subsequent call to CharAppender.whitespaceCount() should return 0.
resetWhitespaceCount in interface CharAppenderpublic final char[] getChars()
CharAppender
getChars in interface CharAppender
public void fill(char ch,
int length)
CharAppender
fill in interface CharAppenderch - the character to appendlength - the number of times the given character should be appended.public void prepend(char ch)
prepend in interface CharAppenderch - the character to prepend in front of the current accumulated value.
public void prepend(char ch1,
char ch2)
CharAppender
prepend in interface CharAppenderch1 - 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 void prepend(char[] chars)
CharAppender
prepend in interface CharAppenderchars - the character sequence to prepend in front of the current accumulated value.public final void updateWhitespace()
updateWhitespace in interface CharAppender
public char appendUntil(char ch,
CharInput input,
char stop)
CharAppender
appendUntil in interface CharAppenderch - the first character of the input to be appended.input - the input whose the following characters will be appendedstop - the stop character
public char appendUntil(char ch,
CharInput input,
char stop1,
char stop2)
CharAppender
appendUntil in interface CharAppenderch - 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
public char appendUntil(char ch,
CharInput input,
char stop1,
char stop2,
char stop3)
CharAppender
appendUntil in interface CharAppenderch - 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
public void append(char[] ch,
int from,
int length)
CharAppender
append in interface CharAppenderch - 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(char[] ch)
CharAppender
append in interface CharAppenderch - the character array
public void append(String string,
int from,
int to)
CharAppender
append in interface CharAppenderstring - the string whose characters will be appended.from - the index of the first character to appendto - the index of the last character to appendpublic final void append(String string)
CharAppenderString
append in interface CharAppenderstring - the input Stringpublic final char charAt(int i)
charAt in interface CharSequence
public final String subSequence(int from,
int to)
subSequence in interface CharSequence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||