com.instantbank.lettertemplate.control.web.handlers
Class MultipartInputStreamHandler

java.lang.Object
  |
  +--com.instantbank.lettertemplate.control.web.handlers.MultipartInputStreamHandler

class MultipartInputStreamHandler
extends java.lang.Object

A class to aid in reading multipart/form-data from a ServletInputStream. It keeps track of how many bytes have been read and detects when the Content-Length limit has been reached. This is necessary since some servlet engines are slow to notice the end of stream. Mac users: The Mac doesn't like class names which exceed 32 characters (including the ".class") so while this class is usable from a JAR anywhere, it won't compile on a Mac.


Field Summary
(package private)  byte[] buf
           
(package private)  javax.servlet.ServletInputStream in
           
(package private)  int totalExpected
           
(package private)  int totalRead
           
 
Constructor Summary
MultipartInputStreamHandler(javax.servlet.ServletInputStream in, int totalExpected)
          Constructor for the MultipartInputStreamHandler object
 
Method Summary
 java.lang.String readLine()
          Reads the next line of input.
 int readLine(byte[] b, int off, int len)
          A pass-through to ServletInputStream.readLine() that keeps track of how many bytes have been read and stops reading when the Content-Length limit has been reached.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

in

javax.servlet.ServletInputStream in

totalExpected

int totalExpected

totalRead

int totalRead

buf

byte[] buf
Constructor Detail

MultipartInputStreamHandler

public MultipartInputStreamHandler(javax.servlet.ServletInputStream in,
                                   int totalExpected)
Constructor for the MultipartInputStreamHandler object
Parameters:
in - Description of the Parameter
totalExpected - Description of the Parameter
Method Detail

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads the next line of input. Returns null to indicate the end of stream.
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readLine

public int readLine(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException
A pass-through to ServletInputStream.readLine() that keeps track of how many bytes have been read and stops reading when the Content-Length limit has been reached.
Parameters:
b - Description of the Parameter
off - Description of the Parameter
len - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception