Package eu.bandm.tools.util.java
Interface Strings.TextConsumer
- All Superinterfaces:
Consumer<String>,IntConsumer
- Enclosing class:
Strings
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface Strings.TextConsumer
extends IntConsumer, Consumer<String>
Functional interface for consuming text from either strings or single
Unicode code points.
Implementing classes must override the method accept(int).
Implementing classes may override the method accept(String) if a
more efficient implementation can be provided.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(int codePoint) Consume a fragment of text given by a single Unicode code point.default voidConsume a fragment of text given by a string.static Strings.TextConsumerof(StringBuilder buf) Returns a consumer view of a given string builder.Methods inherited from interface java.util.function.IntConsumer
andThen
-
Method Details
-
accept
void accept(int codePoint) Consume a fragment of text given by a single Unicode code point.Behavior is unspecified if
codePointis not a valid Unicode code point.Note that a Unicode code point is not the same thing as a value of type
char.- Specified by:
acceptin interfaceIntConsumer- See Also:
-
accept
Consume a fragment of text given by a string.The default implementation iterates over the code points of the given string, and delegates each to
accept(int). -
of
Returns a consumer view of a given string builder.- Parameters:
buf- the string builder to post text to- Returns:
- a consumer that appends received text to
buf - Throws:
NullPointerException- ifbufis null- See Also:
-