public class NoopCharAppender extends Object implements CharAppender
CharAppender
that does nothing. Used by ParserOutput
to transparently discard any unwanted input while parsing.ParserOutput
,
CharAppender
Modifier and Type | Method and Description |
---|---|
void |
append(char ch)
Does nothing
|
void |
append(char[] ch)
Does nothing
|
void |
append(char[] ch,
int from,
int length)
Does nothing
|
void |
append(int ch)
Does nothing
|
void |
append(int[] ch)
Does nothing
|
void |
append(Object obj)
Does nothing
|
void |
append(String string)
Does nothing
|
void |
append(String string,
int from,
int to)
Does nothing
|
void |
appendIgnoringPadding(char ch,
char padding)
Does nothing
|
void |
appendIgnoringWhitespace(char ch)
Does nothing
|
void |
appendIgnoringWhitespaceAndPadding(char ch,
char padding)
Does nothing
|
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)
Does nothing
|
void |
delete(int count)
Does nothing
|
void |
fill(char ch,
int length)
Does nothing
|
String |
getAndReset()
Returns null as this appender does nothing.
|
char[] |
getChars()
Does nothing
|
char[] |
getCharsAndReset()
Returns null as this appender does nothing.
|
static CharAppender |
getInstance()
Returns the singleton instance of NoopCharAppender
|
void |
ignore(int count)
Does nothing
|
int |
indexOf(char[] charSequence,
int from)
Does nothing
|
int |
indexOf(char ch,
int from)
Does nothing
|
int |
indexOf(CharSequence charSequence,
int from)
Does nothing
|
int |
indexOfAny(char[] chars,
int from)
Does nothing
|
boolean |
isEmpty()
Returns
true as it's always empty. |
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)
|
int |
length()
Returns -1 as this appender does nothing.
|
void |
prepend(char ch)
Does nothing
|
void |
prepend(char[] chars)
Does nothing
|
void |
prepend(char ch1,
char ch2)
Does nothing
|
void |
remove(int from,
int length)
Does nothing
|
void |
reset()
Does nothing
|
void |
resetWhitespaceCount()
Does nothing
|
CharSequence |
subSequence(int i,
int i1)
Does nothing
|
String |
substring(int from,
int length)
Does nothing
|
void |
updateWhitespace()
Does nothing
|
int |
whitespaceCount()
Returns 0 as this appender does nothing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
chars, codePoints, toString
public static CharAppender getInstance()
public int length()
length
in interface CharAppender
length
in interface CharSequence
public String getAndReset()
getAndReset
in interface CharAppender
public void appendIgnoringWhitespace(char ch)
appendIgnoringWhitespace
in interface CharAppender
ch
- character to appendpublic void append(char ch)
append
in interface CharAppender
ch
- the character to appendpublic char[] getCharsAndReset()
getCharsAndReset
in interface CharAppender
public int whitespaceCount()
whitespaceCount
in interface CharAppender
public void reset()
reset
in interface CharAppender
public void resetWhitespaceCount()
resetWhitespaceCount
in interface CharAppender
public char[] getChars()
getChars
in interface CharAppender
public void fill(char ch, int length)
fill
in interface CharAppender
ch
- the character to appendlength
- the number of times the given character should be appended.public void appendIgnoringPadding(char ch, char padding)
appendIgnoringPadding
in interface CharAppender
ch
- character to appendpadding
- the padding character to ignorepublic void appendIgnoringWhitespaceAndPadding(char ch, char padding)
appendIgnoringWhitespaceAndPadding
in interface CharAppender
ch
- character to appendpadding
- the padding character to ignorepublic void prepend(char ch)
prepend
in interface CharAppender
ch
- the character to prepend in front of the current accumulated value.public void updateWhitespace()
updateWhitespace
in interface CharAppender
public char appendUntil(char ch, CharInput input, char stop)
CharAppender
appendUntil
in interface CharAppender
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
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
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 void append(char[] ch, int from, int length)
append
in interface CharAppender
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 void prepend(char ch1, char ch2)
prepend
in interface CharAppender
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 void prepend(char[] chars)
prepend
in interface CharAppender
chars
- the character sequence to prepend in front of the current accumulated value.public void append(char[] ch)
append
in interface CharAppender
ch
- the character arraypublic void append(String string)
append
in interface CharAppender
string
- the input Stringpublic void append(String string, int from, int to)
append
in interface CharAppender
string
- the string whose characters will be appended.from
- the index of the first character to appendto
- the index of the last character to appendpublic char charAt(int i)
charAt
in interface CharSequence
public CharSequence subSequence(int i, int i1)
subSequence
in interface CharSequence
public void append(int ch)
append
in interface CharAppender
ch
- the codepoint to appendpublic void append(int[] ch)
append
in interface CharAppender
ch
- the codepoint arraypublic void append(Object obj)
append
in interface CharAppender
obj
- the object whose String
representation will be appended.public void ignore(int count)
ignore
in interface CharAppender
count
- the number of characters to ignorepublic int indexOf(char ch, int from)
indexOf
in interface CharAppender
ch
- the character to look forfrom
- the starting index from where the search will begin.-1
if not foundpublic String substring(int from, int length)
substring
in interface CharAppender
from
- the starting position in the bufferlength
- the number of characters to accumulate from the given start positionString
with the section of characters accumulated by this appender.public void remove(int from, int length)
remove
in interface CharAppender
from
- the starting position in the buffer (inclusive)length
- the number of characters to accumulate from the given start positionpublic void delete(int count)
delete
in interface CharAppender
count
- the number of characters to delete.public int indexOfAny(char[] chars, int from)
indexOfAny
in interface CharAppender
chars
- the characters to look forfrom
- the starting index from where the search will begin.-1
if none foundpublic int indexOf(char[] charSequence, int from)
indexOf
in interface CharAppender
charSequence
- the character sequence to look forfrom
- the starting index from where the search will begin.-1
if not foundpublic int indexOf(CharSequence charSequence, int from)
indexOf
in interface CharAppender
charSequence
- the character sequence to look forfrom
- the starting index from where the search will begin.-1
if not foundpublic boolean isEmpty()
true
as it's always empty.isEmpty
in interface CharAppender
CharAppender.getAndReset()
would return null
, otherwise false
.public int lastIndexOf(char ch)
CharAppender
lastIndexOf
in interface CharAppender
ch
- the character to look for-1
if not found.Copyright © 2020 Univocity Software Pty Ltd. All rights reserved.