com.radekzitek.userver.httpio
Class HttpConnection
java.lang.Object
com.radekzitek.userver.httpio.HttpConnection
- public class HttpConnection
- extends java.lang.Object
- Author:
- rzitek
Field Summary |
private static byte[] |
CRLF
|
(package private) java.io.BufferedInputStream |
in
|
private static org.apache.log4j.Logger |
LOG
|
(package private) java.io.BufferedOutputStream |
out
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CRLF
private static final byte[] CRLF
LOG
private static final org.apache.log4j.Logger LOG
in
java.io.BufferedInputStream in
out
java.io.BufferedOutputStream out
HttpConnection
public HttpConnection(java.net.Socket connectionSocket)
throws java.io.IOException
readRequestMessageHead
public HttpRequestMessage readRequestMessageHead()
throws java.io.IOException,
HttpRequestLineFormatException,
HttpUriFormatException,
HttpVersionFormatException,
HttpHeaderFormatException
- Throws:
java.io.IOException
HttpRequestLineFormatException
HttpUriFormatException
HttpVersionFormatException
HttpHeaderFormatException
readResponseMessageHead
public HttpResponseMessage readResponseMessageHead()
throws java.io.IOException,
HttpUriFormatException,
HttpVersionFormatException,
HttpHeaderFormatException,
HttpResponseLineFormatException,
HttpStatusCodeFormatException
- Throws:
java.io.IOException
HttpUriFormatException
HttpVersionFormatException
HttpHeaderFormatException
HttpResponseLineFormatException
HttpStatusCodeFormatException
readChunk
private HttpChunk readChunk()
throws java.io.IOException
- Throws:
java.io.IOException
writeChunk
private void writeChunk(HttpChunk ch,
HttpConnection copyToConnection)
throws java.io.IOException
- Throws:
java.io.IOException
copyBodyTo
public void copyBodyTo(HttpMessage m,
HttpConnection c)
throws java.io.IOException,
HttpHeaderFormatException
- Throws:
java.io.IOException
HttpHeaderFormatException
writeRequestMessageHead
public void writeRequestMessageHead(HttpRequestMessage m)
throws java.io.IOException
- Throws:
java.io.IOException
writeResponseMessageHead
public void writeResponseMessageHead(HttpResponseMessage m)
throws java.io.IOException
- Throws:
java.io.IOException
getIn
public java.io.BufferedInputStream getIn()
- Returns:
- Returns the in.
getOut
public java.io.BufferedOutputStream getOut()
- Returns:
- Returns the out.
readLine
public byte[] readLine()
throws java.io.IOException
- Reads byte array from the input stream until it hits CRLF.
- Returns:
- the byte array read - withour the CRLF
- Throws:
java.io.IOException
- Thrown if it reaches premature end of input.
setIn
public void setIn(java.io.BufferedInputStream in)
- Parameters:
in
- The in to set.
setOut
public void setOut(java.io.BufferedOutputStream out)
- Parameters:
out
- The out to set.
writeLine
public void writeLine(byte[] buff)
throws java.io.IOException
- Writes byte array the output stream and attaches CRLF.
- Parameters:
buff
- line to be written
- Throws:
java.io.IOException