Package org.apache.hc.core5.http.message
Class BasicLineParser
- java.lang.Object
-
- org.apache.hc.core5.http.message.BasicLineParser
-
- All Implemented Interfaces:
LineParser
- Direct Known Subclasses:
LazyLaxLineParser
,LazyLineParser
@Contract(threading=IMMUTABLE) public class BasicLineParser extends java.lang.Object implements LineParser
DefaultLineParser
implementation.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.BitSet
BLANKS
private static java.util.BitSet
COLON
private static java.util.BitSet
FULL_STOP
static BasicLineParser
INSTANCE
private ProtocolVersion
protocol
A version of the protocol to parse.private Tokenizer
tokenizer
-
Constructor Summary
Constructors Constructor Description BasicLineParser()
Creates a new line parser for HTTP.BasicLineParser(ProtocolVersion proto)
Creates a new line parser for the given HTTP-like protocol.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Header
parseHeader(CharArrayBuffer buffer)
Parses a header from the given buffer containing one line of text.(package private) ProtocolVersion
parseProtocolVersion(CharArrayBuffer buffer, ParserCursor cursor)
RequestLine
parseRequestLine(CharArrayBuffer buffer)
Parses a request line.StatusLine
parseStatusLine(CharArrayBuffer buffer)
Parses a status line from the given buffer containing one line of text.
-
-
-
Field Detail
-
INSTANCE
public static final BasicLineParser INSTANCE
-
FULL_STOP
private static final java.util.BitSet FULL_STOP
-
BLANKS
private static final java.util.BitSet BLANKS
-
COLON
private static final java.util.BitSet COLON
-
protocol
private final ProtocolVersion protocol
A version of the protocol to parse. The version is typically not relevant, but the protocol name.
-
tokenizer
private final Tokenizer tokenizer
-
-
Constructor Detail
-
BasicLineParser
public BasicLineParser(ProtocolVersion proto)
Creates a new line parser for the given HTTP-like protocol.- Parameters:
proto
- a version of the protocol to parse, ornull
for HTTP. The actual version is not relevant, only the protocol name.
-
BasicLineParser
public BasicLineParser()
Creates a new line parser for HTTP.
-
-
Method Detail
-
parseProtocolVersion
ProtocolVersion parseProtocolVersion(CharArrayBuffer buffer, ParserCursor cursor) throws ParseException
- Throws:
ParseException
-
parseRequestLine
public RequestLine parseRequestLine(CharArrayBuffer buffer) throws ParseException
Parses a request line.- Specified by:
parseRequestLine
in interfaceLineParser
- Parameters:
buffer
- a buffer holding the line to parse- Returns:
- the parsed request line
- Throws:
ParseException
- in case of a parse error
-
parseStatusLine
public StatusLine parseStatusLine(CharArrayBuffer buffer) throws ParseException
Description copied from interface:LineParser
Parses a status line from the given buffer containing one line of text.- Specified by:
parseStatusLine
in interfaceLineParser
- Parameters:
buffer
- a buffer holding a line to parse- Returns:
- the parsed status line
- Throws:
ParseException
- in case of a parse error
-
parseHeader
public Header parseHeader(CharArrayBuffer buffer) throws ParseException
Description copied from interface:LineParser
Parses a header from the given buffer containing one line of text. The full header line is expected here. Header continuation lines must be joined by the caller before invoking this method.- Specified by:
parseHeader
in interfaceLineParser
- Parameters:
buffer
- a buffer holding the full header line.- Returns:
- the header in the argument buffer.
- Throws:
ParseException
- in case of a parse error
-
-