Class LaxHttpParser
java.lang.Object
org.archive.util.LaxHttpParser
A Modified version of HttpParser which doesn't throw exceptions on bad header lines
A utility class for parsing http header values according to
RFC-2616 Section 4 and 19.3.
- Since:
- 2.0beta1
- Author:
- Michael Becke, Oleg Kalnichevski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpHeader[]Deprecated.use #parseHeaders(InputStream, String)static HttpHeader[]parseHeaders(InputStream is, String charset) Parses headers from the given stream.static StringreadLine(InputStream inputStream) Deprecated.use #readLine(InputStream, String)static StringreadLine(InputStream inputStream, String charset) Read up to"\n"from an (unchunked) input stream.static byte[]readRawLine(InputStream inputStream) Return byte array from an (unchunked) input stream.
-
Constructor Details
-
LaxHttpParser
protected LaxHttpParser()Constructor for LaxHttpParser.
-
-
Method Details
-
readRawLine
Return byte array from an (unchunked) input stream. Stop reading when"\n"terminator encountered If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available,nullis returned.- Parameters:
inputStream- the stream to read from- Returns:
- a byte array from the stream
- Throws:
IOException- if an I/O problem occurs
-
readLine
Read up to"\n"from an (unchunked) input stream. If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available,nullis returned.- Parameters:
inputStream- the stream to read fromcharset- charset of HTTP protocol elements- Returns:
- a line from the stream
- Throws:
IOException- if an I/O problem occurs- Since:
- 3.0
-
readLine
Deprecated.use #readLine(InputStream, String)Read up to"\n"from an (unchunked) input stream. If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available,nullis returned- Parameters:
inputStream- the stream to read from- Returns:
- a line from the stream
- Throws:
IOException- if an I/O problem occurs
-
parseHeaders
Parses headers from the given stream. Headers with the same name are not combined.- Parameters:
is- the stream to read headers fromcharset- the charset to use for reading the data- Returns:
- an array of headers in the order in which they were parsed
- Throws:
IOException- if an IO error occurs while reading from the stream- Since:
- 3.0
-
parseHeaders
Deprecated.use #parseHeaders(InputStream, String)Parses headers from the given stream. Headers with the same name are not combined.- Parameters:
is- the stream to read headers from- Returns:
- an array of headers in the order in which they were parsed
- Throws:
IOException- if an IO error occurs while reading from the stream
-