|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HTTPMessageReader
Stream reader for HTTP messages (requests and responses).
Field Summary | |
protected java.util.ArrayList |
body
The body of the message |
protected java.lang.String |
connection
Header field: Connection |
protected int |
contentLength
Header field: The length of message body |
protected java.util.ArrayList |
header
The header of the message (blank line included) |
protected byte[] |
message
The whole message obtained from the stream |
protected boolean |
mustCloseConnection
Flag that informs whether the connection must be closed or not |
protected int |
offset
Position of body in the message |
(package private) java.lang.String |
versionProtocol
Start/Status line: The version of HTTP protocol, eg. |
Constructor Summary | |
HTTPMessageReader()
|
Method Summary | |
private void |
concatenateHeaderBody()
Concatenates the header and the body in a whole message. |
void |
eraseCommand(java.lang.String cmd,
int nbrParam)
Erases from the header the line containing a command. |
protected void |
retrieveBody(java.io.DataInputStream distream)
Receives the body of the message (if exists) from the stream. |
protected void |
retrieveHeader(java.io.DataInputStream distream)
Reads inside the stream until the "\r\n" couple that separes header from body message. |
static byte[] |
toArray(java.util.ArrayList arraylist)
Converts an ArrayList of Bytes into an array of bytes. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.util.ArrayList header
protected java.util.ArrayList body
protected byte[] message
java.lang.String versionProtocol
protected int contentLength
protected int offset
protected java.lang.String connection
protected boolean mustCloseConnection
Constructor Detail |
public HTTPMessageReader()
Method Detail |
protected void retrieveHeader(java.io.DataInputStream distream) throws java.io.IOException
distream
- the stream of connectionprotected void retrieveBody(java.io.DataInputStream distream) throws java.io.IOException
distream
- the stream of connectionprivate void concatenateHeaderBody()
public static byte[] toArray(java.util.ArrayList arraylist)
arraylist
- an ArrayListpublic void eraseCommand(java.lang.String cmd, int nbrParam)
cmd
- the command that identifies the linenbrParam
- the number of parameter to erase after the command cmd
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |