juglr.net
Class HTTPResponseReader

java.lang.Object
  extended by juglr.net.HTTPReader
      extended by juglr.net.HTTPResponseReader

public class HTTPResponseReader
extends HTTPReader


Field Summary
 
Fields inherited from class juglr.net.HTTPReader
buf, channel, MAX_HEADER_LENGTH
 
Constructor Summary
HTTPResponseReader(java.nio.channels.SocketChannel channel)
           
HTTPResponseReader(java.nio.channels.SocketChannel channel, java.nio.ByteBuffer buf)
           
 
Method Summary
 HTTP.Status readStatus()
          Read a numeric HTTP status code and return it as a HTTP.Status
 HTTP.Version readVersion()
          Parse a HTTP protocol version declaration as used in the HTTP protocol.
 HTTPResponseReader reset(java.nio.channels.SocketChannel channel)
          Reset all state in the reader, preparing it for reading channel.
 
Methods inherited from class juglr.net.HTTPReader
close, readBody, readBody, readHeaderField, readLF, readSpace, streamBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPResponseReader

public HTTPResponseReader(java.nio.channels.SocketChannel channel,
                          java.nio.ByteBuffer buf)

HTTPResponseReader

public HTTPResponseReader(java.nio.channels.SocketChannel channel)
Method Detail

reset

public HTTPResponseReader reset(java.nio.channels.SocketChannel channel)
                         throws java.io.IOException
Description copied from class: HTTPReader
Reset all state in the reader, preparing it for reading channel.

Overrides:
reset in class HTTPReader
Parameters:
channel - the channel to start reading from. If the reader refers a channel then this channel will be closed.
Returns:
always returns this
Throws:
java.io.IOException - if the reader already refers an open channel and there is an error closing it

readVersion

public HTTP.Version readVersion()
                         throws java.io.IOException
Description copied from class: HTTPReader
Parse a HTTP protocol version declaration as used in the HTTP protocol. The buffer will be positioned just after the last parsed character upon method return

Overrides:
readVersion in class HTTPReader
Returns:
the HTTP version or HTTP.Version.ERROR on errors
Throws:
java.io.IOException - upon errors reading from the socket

readStatus

public HTTP.Status readStatus()
                       throws java.io.IOException
Description copied from class: HTTPReader
Read a numeric HTTP status code and return it as a HTTP.Status

Overrides:
readStatus in class HTTPReader
Returns:
a symbollic representation of the HTTP status code
Throws:
java.io.IOException - upon errors reading from the socket