com.oreilly.servlet.multipart
类 LimitedServletInputStream

java.lang.Object
  继承者 java.io.InputStream
      继承者 javax.servlet.ServletInputStream
          继承者 com.oreilly.servlet.multipart.LimitedServletInputStream
所有已实现的接口:
Closeable

public class LimitedServletInputStream
extends javax.servlet.ServletInputStream

A LimitedServletInputStream wraps another ServletInputStream in order to keep track of how many bytes have been read and detect when the Content-Length limit has been reached. This is necessary since some servlet containers are slow to notice the end of stream and cause the client code to hang if it tries to read past it.

版本:
1.0, 2000/10/27, initial revision
作者:
Jason Hunter, Geoff Soutter

构造方法摘要
LimitedServletInputStream(javax.servlet.ServletInputStream in, int totalExpected)
          Creates a LimitedServletInputStream with the specified length limit that wraps the provided ServletInputStream.
 
方法摘要
 int read()
          Implement length limitation on top of the read method of the wrapped ServletInputStream.
 int read(byte[] b, int off, int len)
          Implement length limitation on top of the read method of the wrapped ServletInputStream.
 int readLine(byte[] b, int off, int len)
          Implement length limitation on top of the readLine method of the wrapped ServletInputStream.
 
从类 java.io.InputStream 继承的方法
available, close, mark, markSupported, read, reset, skip
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

LimitedServletInputStream

public LimitedServletInputStream(javax.servlet.ServletInputStream in,
                                 int totalExpected)
Creates a LimitedServletInputStream with the specified length limit that wraps the provided ServletInputStream.

方法详细信息

readLine

public int readLine(byte[] b,
                    int off,
                    int len)
             throws IOException
Implement length limitation on top of the readLine method of the wrapped ServletInputStream.

覆盖:
javax.servlet.ServletInputStream 中的 readLine
参数:
b - an array of bytes into which data is read.
off - an integer specifying the character at which this method begins reading.
len - an integer specifying the maximum number of bytes to read.
返回:
an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached.
抛出:
IOException - if an I/O error occurs.

read

public int read()
         throws IOException
Implement length limitation on top of the read method of the wrapped ServletInputStream.

指定者:
InputStream 中的 read
返回:
the next byte of data, or -1 if the end of the stream is reached.
抛出:
IOException - if an I/O error occurs.

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Implement length limitation on top of the read method of the wrapped ServletInputStream.

覆盖:
InputStream 中的 read
参数:
b - destination buffer.
off - offset at which to start storing bytes.
len - maximum number of bytes to read.
返回:
the number of bytes read, or -1 if the end of the stream has been reached.
抛出:
IOException - if an I/O error occurs.


Copyright © 2013. All Rights Reserved.