GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Servlet::ServletInputStream(3) User Contributed Perl Documentation Servlet::ServletInputStream(3)

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);

  $stream->skip($numbytes);

  if ($stream->markSupported()) {
      $stream->mark($limit);
      $stream->reset();
  }

  $stream->close();

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.

NOTE: 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 java.io.InputStream and javax.servlet.ServletInputStream into a single interface.

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

Throws:

Servlet::Util::IOException
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.

Parameters:

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

Throws:

Servlet::Util::IOException
if marking is not supported
markSupported()
Returns true if the stream supports "mark()" and "reset()", or false if it does not.
read()
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.

Parameters:

\$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

Throws:

Servlet::Util::IOException
if an input exception occurs
Servlet::Util::UndefReferenceException
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.

Parameters:

$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

Throws:

Servlet::Util::IOException
if an input exception occurs
reset
Repositions the stream to the position at the time "mark()" was last called on the stream.

Throws:

Servlet::Util::IOException
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.

Parameters:

$num
the number of bytes to skip

Throws:

Servlet::Util::IOException
if an input exception occurs

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

Brian Moseley, bcm@maz.org
2001-07-13 perl v5.32.1

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

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