org.apache.commons.httpclient
Class HttpParser
java.lang.Object
|
+--org.apache.commons.httpclient.HttpParser
- public class HttpParser
- extends java.lang.Object
A utility class for parsing http header values.
- Since:
- 2.0beta1
- Author:
- Michael Becke, Oleg Kalnichevski
Method Summary |
static Header[] |
parseHeaders(java.io.InputStream is)
Parses headers from the given stream. |
static java.lang.String |
readLine(java.io.InputStream inputStream)
Read up to "\n" from an (unchunked) input stream. |
static byte[] |
readRawLine(java.io.InputStream inputStream)
Return byte array from an (unchunked) input stream. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
readRawLine
public static byte[] readRawLine(java.io.InputStream inputStream)
throws java.io.IOException
- 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,
null
is returned
- Parameters:
inputStream
- the stream to read from- Returns:
- a byte array from the stream
- Throws:
- java.io.IOException - if an I/O problem occurs
readLine
public static java.lang.String readLine(java.io.InputStream inputStream)
throws java.io.IOException
- 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,
null
is returned
- Parameters:
inputStream
- the stream to read from- Returns:
- a line from the stream
- Throws:
- java.io.IOException - if an I/O problem occurs
parseHeaders
public static Header[] parseHeaders(java.io.InputStream is)
throws java.io.IOException,
HttpException
- 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:
- java.io.IOException - if an IO error occurs while reading from the stream
- HttpException - if there is an error parsing a header value
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.