ikrs.httpd
Class AbstractPostDataWrapper

java.lang.Object
  extended by ikrs.httpd.AbstractPostDataWrapper
All Implemented Interfaces:
PostDataWrapper
Direct Known Subclasses:
DefaultPostDataWrapper

public abstract class AbstractPostDataWrapper
extends java.lang.Object
implements PostDataWrapper


Constructor Summary
AbstractPostDataWrapper(CustomLogger logger, HTTPHeaders headers, java.io.InputStream in)
          Creates a new AbstractPostDataWrapper.
 
Method Summary
 long getBytePosition()
          Get the current read position.
 long getContentLength()
          Get the post data's designated content length.
 java.io.InputStream getInputStream()
          Get the input stream associated with this post data.
 CustomLogger getLogger()
           
 HTTPHeaders getRequestHeaders()
          Get the HTTP headers assiciated with this post data.
abstract  ikrs.httpd.datatype.FormData readFormData()
          ??? ...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPostDataWrapper

public AbstractPostDataWrapper(CustomLogger logger,
                               HTTPHeaders headers,
                               java.io.InputStream in)
                        throws java.lang.NullPointerException
Creates a new AbstractPostDataWrapper.

Parameters:
logger - A custom logger to write log messages to.
headers - The HTTPHeaders (usually read from the input stream before; must not be null).
in - The input stream to read the post data from (must not be null).
Throws:
java.lang.NullPointerException - If headers or in is null.
Method Detail

getLogger

public CustomLogger getLogger()

getRequestHeaders

public HTTPHeaders getRequestHeaders()
Get the HTTP headers assiciated with this post data. The returned headers are never null (but may be empty).

Specified by:
getRequestHeaders in interface PostDataWrapper
Returns:
The HTTP headers assiciated with this post data.

getContentLength

public long getContentLength()
Get the post data's designated content length. If the content length is unknown or not available the method should return -1;

Specified by:
getContentLength in interface PostDataWrapper
Returns:
The content length (in bytes) or -1 if the lenght is unknown.

getInputStream

public java.io.InputStream getInputStream()
Get the input stream associated with this post data. Use it to read the data you are interested in; the returned stream is never null.

Specified by:
getInputStream in interface PostDataWrapper
Returns:
The input stream to read the actual post data from.

getBytePosition

public long getBytePosition()
Get the current read position. The input stream is backed to a BytePositionInputStream that keeps track of the read position inside the stream. The position is measured from the first byte of post data (header data not included).

Specified by:
getBytePosition in interface PostDataWrapper
Returns:
The current read position of the post data input stream.

readFormData

public abstract ikrs.httpd.datatype.FormData readFormData()
                                                   throws java.io.IOException,
                                                          HeaderFormatException,
                                                          DataFormatException,
                                                          UnsupportedFormatException
??? ... !!!

Specified by:
readFormData in interface PostDataWrapper
Throws:
java.io.IOException
HeaderFormatException
DataFormatException
UnsupportedFormatException