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 Summary
FieldsModifier and TypeFieldDescriptionprivate final int
Start position column.private final int
Start position line.private final IntPredicate
Character predicate.private final StringBuilder
String builder instance. -
Constructor Summary
ConstructorsConstructorDescriptionStringCollector
(int line, int col, IntPredicate pred) Construct a new instance with the given start position and character predicate. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.IntConsumer
andThen
Methods inherited from interface java.util.function.IntPredicate
and, negate, or
-
Field Details
-
sb
String builder instance. -
line
private final int lineStart position line. -
col
private final int colStart position column. -
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 linecol
- start position colpred
- character predicate
-
-
Method Details
-
test
public boolean test(int value) - Specified by:
test
in interfaceIntPredicate
-
accept
public void accept(int value) - Specified by:
accept
in interfaceIntConsumer
-
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
-