com.univocity.parsers.common.input
Class ExpandingCharAppender

java.lang.Object
  extended by com.univocity.parsers.common.input.DefaultCharAppender
      extended by com.univocity.parsers.common.input.ExpandingCharAppender
All Implemented Interfaces:
CharAppender, CharSequence
Direct Known Subclasses:
WriterCharAppender

public class ExpandingCharAppender
extends DefaultCharAppender

An implementation CharAppender that expands the internal buffer of characters as required.

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Constructor Summary
ExpandingCharAppender(int initialBufferLength, String emptyValue, int whitespaceRangeStart)
          Creates an ExpandingCharAppender a the default value to return when no characters have been accumulated.
ExpandingCharAppender(String emptyValue, int whitespaceRangeStart)
          Creates an ExpandingCharAppender a 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, 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(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
 
Methods inherited from class com.univocity.parsers.common.input.DefaultCharAppender
append, append, append, append, charAt, getAndReset, getChars, getCharsAndReset, length, reset, resetWhitespaceCount, subSequence, toString, updateWhitespace, whitespaceCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpandingCharAppender

public ExpandingCharAppender(String emptyValue,
                             int whitespaceRangeStart)
Creates an ExpandingCharAppender a the default value to return when no characters have been accumulated. The padding character is defaulted to a whitespace character ' '.

Parameters:
emptyValue - default value to return when no characters have been accumulated
whitespaceRangeStart - starting range of characters considered to be whitespace.

ExpandingCharAppender

public ExpandingCharAppender(int initialBufferLength,
                             String emptyValue,
                             int whitespaceRangeStart)
Creates an ExpandingCharAppender a the default value to return when no characters have been accumulated. The padding character is defaulted to a whitespace character ' '.

Parameters:
initialBufferLength - the initial length of the internal buffer.
emptyValue - default value to return when no characters have been accumulated
whitespaceRangeStart - starting range of characters considered to be whitespace.
Method Detail

appendIgnoringWhitespace

public void appendIgnoringWhitespace(char ch)
Description copied from interface: CharAppender
Appends the given character and marks it as ignored if it is a whitespace (ch <= ' ')

Specified by:
appendIgnoringWhitespace in interface CharAppender
Overrides:
appendIgnoringWhitespace in class DefaultCharAppender
Parameters:
ch - character to append

appendIgnoringPadding

public void appendIgnoringPadding(char ch,
                                  char padding)
Description copied from interface: CharAppender
Appends the given character and marks it as ignored if it is a padding character (the definition of a padding character is implementation dependent.)

Specified by:
appendIgnoringPadding in interface CharAppender
Overrides:
appendIgnoringPadding in class DefaultCharAppender
Parameters:
ch - character to append
padding - the padding character to ignore

appendIgnoringWhitespaceAndPadding

public void appendIgnoringWhitespaceAndPadding(char ch,
                                               char padding)
Description copied from interface: CharAppender
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.)

Specified by:
appendIgnoringWhitespaceAndPadding in interface CharAppender
Overrides:
appendIgnoringWhitespaceAndPadding in class DefaultCharAppender
Parameters:
ch - character to append
padding - the padding character to ignore

append

public void append(char ch)
Description copied from interface: CharAppender
Appends the given character.

Specified by:
append in interface CharAppender
Overrides:
append in class DefaultCharAppender
Parameters:
ch - the character to append

fill

public final void fill(char ch,
                       int length)
Description copied from interface: CharAppender
Adds a sequence of repeated characters to the input.

Specified by:
fill in interface CharAppender
Overrides:
fill in class DefaultCharAppender
Parameters:
ch - the character to append
length - the number of times the given character should be appended.

prepend

public final void prepend(char ch)
Description copied from class: DefaultCharAppender
Prepends the current accumulated value with a character

Specified by:
prepend in interface CharAppender
Overrides:
prepend in class DefaultCharAppender
Parameters:
ch - the character to prepend in front of the current accumulated value.

prepend

public final void prepend(char ch1,
                          char ch2)
Description copied from interface: CharAppender
Prepends the current accumulated value with a couple of characters

Specified by:
prepend in interface CharAppender
Overrides:
prepend in class DefaultCharAppender
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 final void prepend(char[] chars)
Description copied from interface: CharAppender
Prepends the current accumulated value a sequence of characters

Specified by:
prepend in interface CharAppender
Overrides:
prepend in class DefaultCharAppender
Parameters:
chars - the character sequence to prepend in front of the current accumulated value.

append

public final void append(DefaultCharAppender appender)
Description copied from class: DefaultCharAppender
Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace characters

Overrides:
append in class DefaultCharAppender
Parameters:
appender - The DefaultCharAppender instance got get contents from.

appendUntil

public final 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 interface CharAppender
Overrides:
appendUntil in class DefaultCharAppender
Parameters:
ch - the first character of the input to be appended.
input - the input whose the following characters will be appended
stop - 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 interface CharAppender
Overrides:
appendUntil in class DefaultCharAppender
Parameters:
ch - the first character of the input to be appended.
input - the input whose the following characters will be appended
stop1 - the first stop character
stop2 - 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 interface CharAppender
Overrides:
appendUntil in class DefaultCharAppender
Parameters:
ch - the first character of the input to be appended.
input - the input whose the following characters will be appended
stop1 - the first stop character
stop2 - the second stop character
stop3 - the third stop character
Returns:
one of the stop characters found on the input.

append

public final void append(char[] ch,
                         int from,
                         int length)
Description copied from interface: CharAppender
Appends characters from an input array

Specified by:
append in interface CharAppender
Overrides:
append in class DefaultCharAppender
Parameters:
ch - the character array
from - the position of the first character in the array to be appended
length - the number of characters to be appended from the given posiion.

append

public final void append(String string,
                         int from,
                         int to)
Description copied from interface: CharAppender
Appends the contents of a String to this appender

Specified by:
append in interface CharAppender
Overrides:
append in class DefaultCharAppender
Parameters:
string - the string whose characters will be appended.
from - the index of the first character to append
to - the index of the last character to append


Copyright © 2017 uniVocity Software Pty Ltd. All rights reserved.