Class NoopCharAppender
- java.lang.Object
-
- com.univocity.parsers.common.input.NoopCharAppender
-
- All Implemented Interfaces:
CharAppender
,java.lang.CharSequence
public class NoopCharAppender extends java.lang.Object implements CharAppender
An implementation ofCharAppender
that does nothing. Used byParserOutput
to transparently discard any unwanted input while parsing.- See Also:
ParserOutput
,CharAppender
-
-
Field Summary
Fields Modifier and Type Field Description private static NoopCharAppender
instance
-
Constructor Summary
Constructors Modifier Constructor Description private
NoopCharAppender()
This is a singleton class and cannot be instantiated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(char ch)
Does nothingvoid
append(char[] ch)
Does nothingvoid
append(char[] ch, int from, int length)
Does nothingvoid
append(int ch)
Does nothingvoid
append(int[] ch)
Does nothingvoid
append(java.lang.Object obj)
Does nothingvoid
append(java.lang.String string)
Does nothingvoid
append(java.lang.String string, int from, int to)
Does nothingvoid
appendIgnoringPadding(char ch, char padding)
Does nothingvoid
appendIgnoringWhitespace(char ch)
Does nothingvoid
appendIgnoringWhitespaceAndPadding(char ch, char padding)
Does nothingchar
appendUntil(char ch, CharInput input, char stop)
Appends characters from the input, until a stop character is foundchar
appendUntil(char ch, CharInput input, char stop1, char stop2)
Appends characters from the input, until a stop character is foundchar
appendUntil(char ch, CharInput input, char stop1, char stop2, char stop3)
Appends characters from the input, until a stop character is foundchar
charAt(int i)
Does nothingvoid
delete(int count)
Does nothingvoid
fill(char ch, int length)
Does nothingjava.lang.String
getAndReset()
Returns null as this appender does nothing.char[]
getChars()
Does nothingchar[]
getCharsAndReset()
Returns null as this appender does nothing.static CharAppender
getInstance()
Returns the singleton instance of NoopCharAppendervoid
ignore(int count)
Does nothingint
indexOf(char[] charSequence, int from)
Does nothingint
indexOf(char ch, int from)
Does nothingint
indexOf(java.lang.CharSequence charSequence, int from)
Does nothingint
indexOfAny(char[] chars, int from)
Does nothingboolean
isEmpty()
Returnstrue
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 nothingvoid
prepend(char[] chars)
Does nothingvoid
prepend(char ch1, char ch2)
Does nothingvoid
remove(int from, int length)
Does nothingvoid
reset()
Does nothingvoid
resetWhitespaceCount()
Does nothingjava.lang.CharSequence
subSequence(int i, int i1)
Does nothingjava.lang.String
substring(int from, int length)
Does nothingvoid
updateWhitespace()
Does nothingint
whitespaceCount()
Returns 0 as this appender does nothing.
-
-
-
Field Detail
-
instance
private static final NoopCharAppender instance
-
-
Constructor Detail
-
NoopCharAppender
private NoopCharAppender()
This is a singleton class and cannot be instantiated. UsegetInstance()
.
-
-
Method Detail
-
getInstance
public static CharAppender getInstance()
Returns the singleton instance of NoopCharAppender- Returns:
- the singleton instance of NoopCharAppender
-
length
public int length()
Returns -1 as this appender does nothing.- Specified by:
length
in interfaceCharAppender
- Specified by:
length
in interfacejava.lang.CharSequence
- Returns:
- -1 as this appender does nothing.
-
getAndReset
public java.lang.String getAndReset()
Returns null as this appender does nothing.- Specified by:
getAndReset
in interfaceCharAppender
- Returns:
- null as this appender does nothing.
-
appendIgnoringWhitespace
public void appendIgnoringWhitespace(char ch)
Does nothing- Specified by:
appendIgnoringWhitespace
in interfaceCharAppender
- Parameters:
ch
- character to append
-
append
public void append(char ch)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
ch
- the character to append
-
getCharsAndReset
public char[] getCharsAndReset()
Returns null as this appender does nothing.- Specified by:
getCharsAndReset
in interfaceCharAppender
- Returns:
- null as this appender does nothing.
-
whitespaceCount
public int whitespaceCount()
Returns 0 as this appender does nothing.- Specified by:
whitespaceCount
in interfaceCharAppender
- Returns:
- 0 as this appender does nothing.
-
reset
public void reset()
Does nothing- Specified by:
reset
in interfaceCharAppender
-
resetWhitespaceCount
public void resetWhitespaceCount()
Does nothing- Specified by:
resetWhitespaceCount
in interfaceCharAppender
-
getChars
public char[] getChars()
Does nothing- Specified by:
getChars
in interfaceCharAppender
- Returns:
- the internal character array.
-
fill
public void fill(char ch, int length)
Does nothing- Specified by:
fill
in interfaceCharAppender
- Parameters:
ch
- the character to appendlength
- the number of times the given character should be appended.
-
appendIgnoringPadding
public void appendIgnoringPadding(char ch, char padding)
Does nothing- Specified by:
appendIgnoringPadding
in interfaceCharAppender
- Parameters:
ch
- character to appendpadding
- the padding character to ignore
-
appendIgnoringWhitespaceAndPadding
public void appendIgnoringWhitespaceAndPadding(char ch, char padding)
Does nothing- Specified by:
appendIgnoringWhitespaceAndPadding
in interfaceCharAppender
- Parameters:
ch
- character to appendpadding
- the padding character to ignore
-
prepend
public void prepend(char ch)
Does nothing- Specified by:
prepend
in interfaceCharAppender
- Parameters:
ch
- the character to prepend in front of the current accumulated value.
-
updateWhitespace
public void updateWhitespace()
Does nothing- Specified by:
updateWhitespace
in interfaceCharAppender
-
appendUntil
public char appendUntil(char ch, CharInput input, char stop)
Description copied from interface:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Parameters:
ch
- the first character of the input to be appended.input
- the input whose the following characters will be appendedstop
- the stop character- Returns:
- the stop character found on the input.
-
appendUntil
public final char appendUntil(char ch, CharInput input, char stop1, char stop2)
Description copied from interface:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Parameters:
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 character- Returns:
- one of the stop characters found on the input.
-
appendUntil
public final char appendUntil(char ch, CharInput input, char stop1, char stop2, char stop3)
Description copied from interface:CharAppender
Appends characters from the input, until a stop character is found- Specified by:
appendUntil
in interfaceCharAppender
- Parameters:
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 character- Returns:
- one of the stop characters found on the input.
-
append
public void append(char[] ch, int from, int length)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
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.
-
prepend
public void prepend(char ch1, char ch2)
Does nothing- Specified by:
prepend
in interfaceCharAppender
- Parameters:
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.
-
prepend
public void prepend(char[] chars)
Does nothing- Specified by:
prepend
in interfaceCharAppender
- Parameters:
chars
- the character sequence to prepend in front of the current accumulated value.
-
append
public void append(char[] ch)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
ch
- the character array
-
append
public void append(java.lang.String string)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
string
- the input String
-
append
public void append(java.lang.String string, int from, int to)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
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
-
charAt
public char charAt(int i)
Does nothing- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int i, int i1)
Does nothing- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
append
public void append(int ch)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
ch
- the codepoint to append
-
append
public void append(int[] ch)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
ch
- the codepoint array
-
append
public void append(java.lang.Object obj)
Does nothing- Specified by:
append
in interfaceCharAppender
- Parameters:
obj
- the object whoseString
representation will be appended.
-
ignore
public void ignore(int count)
Does nothing- Specified by:
ignore
in interfaceCharAppender
- Parameters:
count
- the number of characters to ignore
-
indexOf
public int indexOf(char ch, int from)
Does nothing- Specified by:
indexOf
in interfaceCharAppender
- Parameters:
ch
- the character to look forfrom
- the starting index from where the search will begin.- Returns:
- the position of the given character in the appended content,
-1
if not found
-
substring
public java.lang.String substring(int from, int length)
Does nothing- Specified by:
substring
in interfaceCharAppender
- Parameters:
from
- the starting position in the bufferlength
- the number of characters to accumulate from the given start position- Returns:
- a
String
with the section of characters accumulated by this appender.
-
remove
public void remove(int from, int length)
Does nothing- Specified by:
remove
in interfaceCharAppender
- Parameters:
from
- the starting position in the buffer (inclusive)length
- the number of characters to accumulate from the given start position
-
delete
public void delete(int count)
Does nothing- Specified by:
delete
in interfaceCharAppender
- Parameters:
count
- the number of characters to delete.
-
indexOfAny
public int indexOfAny(char[] chars, int from)
Does nothing- Specified by:
indexOfAny
in interfaceCharAppender
- Parameters:
chars
- the characters to look forfrom
- the starting index from where the search will begin.- Returns:
- the position any one of the given characters in the appended content,
-1
if none found
-
indexOf
public int indexOf(char[] charSequence, int from)
Does nothing- Specified by:
indexOf
in interfaceCharAppender
- Parameters:
charSequence
- the character sequence to look forfrom
- the starting index from where the search will begin.- Returns:
- the position of the given character sequence in the appended content,
-1
if not found
-
indexOf
public int indexOf(java.lang.CharSequence charSequence, int from)
Does nothing- Specified by:
indexOf
in interfaceCharAppender
- Parameters:
charSequence
- the character sequence to look forfrom
- the starting index from where the search will begin.- Returns:
- the position of the given character sequence in the appended content,
-1
if not found
-
isEmpty
public boolean isEmpty()
Returnstrue
as it's always empty.- Specified by:
isEmpty
in interfaceCharAppender
- Returns:
- true calling
CharAppender.getAndReset()
would returnnull
, otherwisefalse
.
-
lastIndexOf
public int lastIndexOf(char ch)
Description copied from interface:CharAppender
Returns the last index of a given character in the current appended (characters that have been marked as whitespace will be ignored)- Specified by:
lastIndexOf
in interfaceCharAppender
- Parameters:
ch
- the character to look for- Returns:
- the last position of the given character in the appended content, or
-1
if not found.
-
-