Class ExpandingCharAppender

    • Constructor Summary

      Constructors 
      Constructor Description
      ExpandingCharAppender​(int initialBufferLength, java.lang.String emptyValue, int whitespaceRangeStart)
      Creates an ExpandingCharAppender a the default value to return when no characters have been accumulated.
      ExpandingCharAppender​(java.lang.String emptyValue, int whitespaceRangeStart)
      Creates an ExpandingCharAppender a the default value to return when no characters have been accumulated.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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​(java.lang.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
      (package private) void expand()  
      (package private) void expand​(int additionalLength)  
      private void expand​(int additionalLength, double factor)  
      (package private) void expandAndRetry()  
      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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints
    • Constructor Detail

      • ExpandingCharAppender

        public ExpandingCharAppender​(java.lang.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,
                                     java.lang.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

      • 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
      • 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.
      • expandAndRetry

        final void expandAndRetry()
      • expand

        private void expand​(int additionalLength,
                            double factor)
      • expand

        final void expand()
      • expand

        final void expand​(int additionalLength)
      • 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​(java.lang.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