Package org.dellroad.msrp.msg
Class LineInputParser
- java.lang.Object
-
- org.dellroad.msrp.msg.LineInputParser
-
public class LineInputParser extends Object
Parses CRLF-terminated lines.
-
-
Constructor Summary
Constructors Constructor Description LineInputParser(int maxLength)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringinputLineByte(byte b)Input the next byte.booleanisBetweenLines()Determine whether this instance is sitting at a line boundary.voidreset()Reset parse state.
-
-
-
Constructor Detail
-
LineInputParser
public LineInputParser(int maxLength)
Constructor.- Parameters:
maxLength- maximum allowed line length in bytes- Throws:
IllegalArgumentException- ifmaxLengthnegative
-
-
Method Detail
-
inputLineByte
public String inputLineByte(byte b) throws ProtocolException
Input the next byte.- Parameters:
b- input byte- Returns:
- complete line (not including CRLF), or null if more bytes are needed
- Throws:
ProtocolException- if the line exceeds the maximum allowed length
-
isBetweenLines
public boolean isBetweenLines()
Determine whether this instance is sitting at a line boundary.This will be true after initial construction, invocation of
reset(), or an invocationinputLineByte()that returned a non-null value.- Returns:
- true if positioned on a line boundary
-
reset
public void reset()
Reset parse state.
-
-