Package org.eclipse.jetty.util
Class Utf8LineParser
java.lang.Object
org.eclipse.jetty.util.Utf8LineParser
Stateful parser for lines of UTF8 formatted text, looking for
"\n"
as a line termination character.
For use with new IO framework that is based on ByteBuffer parsing.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionparse
(ByteBuffer buf) Parse a ByteBuffer (could be a partial buffer), and return once a complete line of UTF8 parsed text has been reached.
-
Constructor Details
-
Utf8LineParser
public Utf8LineParser()
-
-
Method Details
-
parse
Parse a ByteBuffer (could be a partial buffer), and return once a complete line of UTF8 parsed text has been reached.- Parameters:
buf
- the buffer to parse (could be an incomplete buffer)- Returns:
- the line of UTF8 parsed text, or null if no line end termination has been reached within the
remaining
bytes of the provided ByteBuffer. (In the case of a null, a subsequent ByteBuffer with a line end termination should be provided) - Throws:
IllegalArgumentException
- if the input buffer has bytes that do not conform to UTF8 validation (validation performed byUtf8StringBuilder
-