Class SimpleTextParser.StringCollector

java.lang.Object
org.apache.commons.geometry.io.core.internal.SimpleTextParser.StringCollector
All Implemented Interfaces:
IntConsumer, IntPredicate
Enclosing class:
SimpleTextParser

private final class SimpleTextParser.StringCollector extends Object implements IntPredicate, IntConsumer
Internal class used to collect strings from the character stream while ensuring that the collected strings do not exceed the maximum configured string length.
  • Field Details

    • sb

      private final StringBuilder sb
      String builder instance.
    • line

      private final int line
      Start position line.
    • col

      private final int col
      Start position column.
    • pred

      private final IntPredicate pred
      Character predicate.
  • Constructor Details

    • StringCollector

      StringCollector(int line, int col, IntPredicate pred)
      Construct a new instance with the given start position and character predicate.
      Parameters:
      line - start position line
      col - start position col
      pred - character predicate
  • Method Details

    • test

      public boolean test(int value)
      Specified by:
      test in interface IntPredicate
    • accept

      public void accept(int value)
      Specified by:
      accept in interface IntConsumer
    • getString

      public String getString()
      Get the string collected by this instance.
      Returns:
      the string collected by this instance
      Throws:
      IllegalStateException - if the string exceeds the maximum configured length
    • hasExceededMaxStringLength

      private boolean hasExceededMaxStringLength()
      Return true if this collector has exceeded the maximum configured string length.
      Returns:
      true if this collector has exceeded the maximum string length