Top Description Inners Fields Constructors Methods
org.eclipse.jetty.util

public Class Utf8LineParser

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private Utf8LineParser.State
private Utf8StringBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

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)
parse
(ByteBuffer
the buffer to parse (could be an incomplete buffer)
buf
)

Parse a ByteBuffer (could be a partial buffer), and return once a complete line of UTF8 parsed text has been reached.

private boolean
parseByte(byte b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stateback to summary
private Utf8LineParser.State state
utfback to summary
private Utf8StringBuilder utf

Constructor Detail

Utf8LineParserback to summary
public Utf8LineParser()

Method Detail

parseback to summary
public String parse(ByteBuffer buf)

Parse a ByteBuffer (could be a partial buffer), and return once a complete line of UTF8 parsed text has been reached.

Parameters
buf:ByteBuffer

the buffer to parse (could be an incomplete buffer)

Returns:String

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)

Exceptions
IllegalArgumentException:
if the input buffer has bytes that do not conform to UTF8 validation (validation performed by Utf8StringBuilder
parseByteback to summary
private boolean parseByte(byte b)
org.eclipse.jetty.util back to summary

private final Enum Utf8LineParser.State

extends Enum<Utf8LineParser.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Utf8LineParser.State
public static final Utf8LineParser.State
public static final Utf8LineParser.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Utf8LineParser.State
public static Utf8LineParser.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ENDback to summary
public static final Utf8LineParser.State END
PARSEback to summary
public static final Utf8LineParser.State PARSE
STARTback to summary
public static final Utf8LineParser.State START

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Utf8LineParser.State valueOf(String name)
valuesback to summary
public static Utf8LineParser.State[] values()