public class LimitedServletInputStream
extends javax.servlet.ServletInputStream
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.| 构造器和说明 |
|---|
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. |
public LimitedServletInputStream(javax.servlet.ServletInputStream in,
int totalExpected)
LimitedServletInputStream with the specified
length limit that wraps the provided ServletInputStream.public int readLine(byte[] b,
int off,
int len)
throws java.io.IOException
readLine method of
the wrapped ServletInputStream.readLine 在类中 javax.servlet.ServletInputStreamb - 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.java.io.IOException - if an I/O error occurs.public int read()
throws java.io.IOException
read method of
the wrapped ServletInputStream.read 在类中 java.io.InputStream-1 if the end of the
stream is reached.java.io.IOException - if an I/O error occurs.public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read method of
the wrapped ServletInputStream.read 在类中 java.io.InputStreamb - destination buffer.off - offset at which to start storing bytes.len - maximum number of bytes to read.-1 if the end of
the stream has been reached.java.io.IOException - if an I/O error occurs.Copyright © 2017. All Rights Reserved.