Package org.apache.http.nio
Interface NHttpMessageParser<T extends HttpMessage>
-
- All Known Implementing Classes:
AbstractMessageParser
,DefaultHttpRequestParser
,DefaultHttpResponseParser
,HttpRequestParser
,HttpResponseParser
public interface NHttpMessageParser<T extends HttpMessage>
Abstract HTTP message parser for non-blocking connections.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
fillBuffer(java.nio.channels.ReadableByteChannel channel)
Fills the internal buffer of the parser with input data from the givenReadableByteChannel
.T
parse()
Attempts to parse a complete message head from the content of the internal buffer.void
reset()
Resets the parser.
-
-
-
Method Detail
-
reset
void reset()
Resets the parser. The parser will be ready to start parsing another HTTP message.
-
fillBuffer
int fillBuffer(java.nio.channels.ReadableByteChannel channel) throws java.io.IOException
Fills the internal buffer of the parser with input data from the givenReadableByteChannel
.- Parameters:
channel
- the input channel- Returns:
- number of bytes read.
- Throws:
java.io.IOException
- in case of an I/O error.
-
parse
T parse() throws java.io.IOException, HttpException
Attempts to parse a complete message head from the content of the internal buffer. If the message in the input buffer is incomplete this method will returnnull
.- Returns:
- HTTP message head, if available,
null
otherwise. - Throws:
java.io.IOException
- in case of an I/O error.HttpException
- in case the HTTP message is malformed or violates the HTTP protocol.
-
-