Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  SERVLET::SERVLETINPUTSTREAM (3)

.ds Aq ’


Servlet::ServletInputStream - servlet input stream interface



  my $byte = $stream->read();

  my $numbytes = $stream->read(\$buffer);
  my $numbytes = $stream->read(\$buffer, $offset, $length);

  my $numbytes = $stream->readLine(\$buffer, $offset, $length);


  if ($stream->markSupported()) {



Provides an input stream for reading binary data from a client request. With some protocols, such as HTTP POST and PUT, the stream can be used to read data sent from the client.

An input stream object is normally retrieved via getInputStream in Servlet::ServletRequest.

<B>NOTE:B> While this is an abstract class in the Java API, the Perl API provides it as an interface. The main difference is that the Perl version has no constructor. Also, it merges the methods declared in <B>> and <B>javax.servlet.ServletInputStreamB> into a single interface.


close() Closes the stream and releases any system resources associated with the stream.

<B>Servlet::Util::IOExceptionB> if an input exception occurs

mark($limit) Marks the current position in the stream. A subsequent call to reset() repositions the stream at the last marked position so that subsequent reads re-read the same bytes.

The $limit argument tells the stream to allow that many bytes to be read before the mark position is invalidated. If more than $limit bytes are read, a call to reset() will have no effect.

$limit the maximum number of bytest hat can be read before the marked position becomes invalid

<B>Servlet::Util::IOExceptionB> if marking is not supported

markSupported() Returns true if the stream supports mark() and reset(), or false if it does not.
read(\$buffer, $length)
read(\$buffer, $length, $offset) If no arguments are specified, returns the next byte of data from the stream, or undef if no byte is available because the end of the stream has been reached.

If arguments are specified, reads up to $length bytes from the stream, stores them in $buffer, and returns the number of bytes read (or undef if no bytes are available because the end of the stream has been reached).

If $offset is specified, the read data is placed $offset bytes from the beginning of $buffer. If $offset is negative, it will be counted backwardsd from the end of the string. If $offset is positive and greater than the length of $buffer, the scalar will be padded to the required size with \0 bytes before the result of the read is appended.

Blocks until input data is available, the end of the stream is detected, or an exception is thrown.

\$buffer a reference to a scalar buffer into which the data is read
$length the maximum number of bytes to read
$offset the location in $buffer where data is written

<B>Servlet::Util::IOExceptionB> if an input exception occurs
<B>Servlet::Util::UndefReferenceExceptionB> if $buffer is specified as undef

readLine(\$buffer, $offset, $length) Reads the input stream one line at a time. Starting at an offset, reads bytes into the buffer until it reads a certain number of bytes or reaches a newline character, which it reads into the array as well. Returns the number of bytes read, or -1 if it reaches the end of the input stream before reading the maximum number of bytes.

$buffer a reference to a scalar into which data is read
$offset an integer specifying the byte at which the method begins reading
$length an integer specifying the maximum number of bytes to read

<B>Servlet::Util::IOExceptionB> if an input exception occurs

reset Repositions the stream to the position at the time mark() was last called on the stream.

<B>Servlet::Util::IOExceptionB> if the stream has not been marked, the mark has been invalidated, or marking is not supported

skip($num) Skips over and discards $num bytes of data from the stream and returns the number of bytes skipped, or -1 if no bytes were skipped.

$num the number of bytes to skip

<B>Servlet::Util::IOExceptionB> if an input exception occurs


Servlet::ServletRequest, Servlet::Util::Exception


Brian Moseley,
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 SERVLET::SERVLETINPUTSTREAM (3) 2001-07-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.