All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javax.servlet.ServletInputStream

javax.servlet.ServletInputStream

public abstract class ServletInputStream
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:
read

Constructor Index

 o ServletInputStream()
The default constructor does no work.

Method Index

 o readLine(byte[], int, int)
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.

Constructors

 o ServletInputStream
 protected ServletInputStream()
The default constructor does no work.

Methods

 o readLine
 public int readLine(byte b[],
                     int off,
                     int len) throws 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 read
off - the start offset of the data
len - 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: IOException
if an I/O error has occurred

All Packages  Class Hierarchy  This Package  Previous  Next  Index