|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--javax.servlet.ServletInputStream | +--org.apache.catalina.connector.RequestStream
Convenience implementation of ServletInputStream that works with the standard implementations of Request. If the content length has been set on our associated Request, this implementation will enforce not reading more than that many bytes on the underlying stream.
Field Summary | |
protected byte[] |
buffer
The input buffer for our stream. |
protected static int |
BUFFER_SIZE
The default buffer size for our input buffer. |
protected int |
bufferCount
The current number of bytes in the buffer. |
protected int |
bufferPosition
The current position in the buffer. |
protected boolean |
closed
Has this stream been closed? |
protected int |
count
The number of bytes which have already been returned by this stream. |
protected int |
length
The content length past which we will not read, or -1 if there is no defined content length. |
protected static StringManager |
sm
The localized strings for this package. |
protected java.io.InputStream |
stream
The underlying input stream from which we should read data. |
Constructor Summary | |
RequestStream(Request request)
Construct a servlet input stream associated with the specified Request. |
Method Summary | |
int |
available()
Return the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method on this input stream. |
void |
close()
Close this input stream. |
protected int |
copyLine(byte[] source,
int srcOff,
byte[] dest,
int destOff,
int len)
Copy up to a line of data from source to destination buffer. |
protected void |
fill()
Refill the buffer from the underlying stream. |
int |
read()
Read and return a single byte from this input stream, or -1 if end of file has been encountered. |
int |
read(byte[] b)
Read some number of bytes from the input stream, and store them into the buffer array b. |
int |
read(byte[] b,
int off,
int len)
Read up to len bytes of data from the input stream
into an array of bytes. |
int |
readLine(byte[] b,
int off,
int len)
Read into an array of bytes until all requested bytes have been read or a '\n' is encountered, in which case the '\n' is read into the array as well. |
long |
skip(long n)
Skip the specified number of bytes of input, and return the actual number of bytes skipped. |
Methods inherited from class java.io.InputStream |
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int BUFFER_SIZE
protected byte[] buffer
protected int bufferCount
protected int bufferPosition
protected boolean closed
protected int count
protected int length
protected static StringManager sm
protected java.io.InputStream stream
Constructor Detail |
public RequestStream(Request request)
request
- The associated requestMethod Detail |
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- if an input/output error occurspublic void close() throws java.io.IOException
close
in class java.io.InputStream
java.io.IOException
- if an input/output error occurspublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if an input/output error occurspublic int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
b
- The buffer into which the data is readjava.io.IOException
- if an input/output error occurspublic int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from the input stream
into an array of bytes. An attempt is made to read as many as
len
bytes, but a smaller number may be read,
possibly zero. The number of bytes actually read is returned as
an integer. This method blocks until input data is available,
end of file is detected, or an exception is thrown.read
in class java.io.InputStream
b
- The buffer into which the data is readoff
- The start offset into array b
at which
the data is writtenlen
- The maximum number of bytes to readjava.io.IOException
- if an input/output error occurspublic int readLine(byte[] b, int off, int len) throws java.io.IOException
readLine
in class javax.servlet.ServletInputStream
b
- The buffer where data is storedoff
- The start offset into the bufferlen
- The maximum number of bytes to be returnedjava.io.IOException
- if an input/output error occurspublic long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
n
- The number of bytes to be skippedjava.io.IOException
- if an input/output error occursprotected int copyLine(byte[] source, int srcOff, byte[] dest, int destOff, int len)
protected void fill() throws java.io.IOException
java.io.IOException
- if an input/output error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |