javax.servlet
Class ServletInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--javax.servlet.ServletInputStream
- public abstract class ServletInputStream
- extends java.io.InputStream
An input stream for reading servlet requests, it provides an
efficient readLine method. This is an abstract class, to be
implemented by a network services writer. For some application
protocols, such as the HTTP POST and PUT methods, servlet writers
use the input stream to get data from clients. They access the
input stream via the ServletRequest's getInputStream method,
available from within the servlet's service method. Subclasses of
ServletInputStream must provide an implementation of the read()
method.
- See Also:
InputStream.read()
Method Summary |
int |
readLine(byte[] b,
int off,
int len)
Starting at the specified offset, reads into the given 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. |
Methods inherited from class java.io.InputStream |
available,
close,
mark,
markSupported,
read,
read,
read,
reset,
skip |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ServletInputStream
protected ServletInputStream()
- The default constructor does no work.
readLine
public int readLine(byte[] b,
int off,
int len)
throws java.io.IOException
- Starting at the specified offset, reads into the given 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.
- Parameters:
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes to read- Returns:
- the actual number of bytes read, or -1 if the end of the
stream is reached
- Throws:
- java.io.IOException - if an I/O error has occurred