NAME

Servlet::ServletOutputStream - servlet output stream interface


SYNOPSIS

  $stream->print($string);
  $stream->println();
  $stream->println($string);
  $stream->write($string);
  $stream->write($string, $length);
  $stream->write($string, $length, $offset);
  $stream->flush();
  $stream->close();


DESCRIPTION

Provides an output stream for writing binary data to a servlet response.

An output stream object is normally retrieved via getOutputStream in the Servlet::ServletResponse manpage.

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.OutputStream and javax.servlet.ServletOutputStream into a single interface.


METHODS

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

Throws:

Servlet::Util::IOException
if an output exception occurred

flush()
Flushes this input stream and forces any buffered output bytes to be written out.

Throws:

Servlet::Util::IOException
if an output exception occurred

print($value)
Writes a scalar value to the client, with no carriage return-line feed (CRLF) character at the end.

Parameters:

$value
the value to send to the client

Throws:

Servlet::Util::IOException
if an output exception occurred

println([$value])
Writes a scalar value to the client, if specified, followed by a carriage return-line feed (CRLF) character.

Parameters:

$value
the (optional) value to send to the client

Throws:

Servlet::Util::IOException
if an output exception occurred

write($value)
write($value, $length)
write($value, $length, $offset)
Writes the scalar $value to the stream.

If no arguments are specified, functions exactly equivalently to print().

If $length is specified, writes that many bytes from $value. If $offset is specified, starts writing that many bytes from the beginning of $value. $offset and $length must not be negative, and $length must not be greater than the amount of data in $value starting from $offset.

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

Parameters:

$value
a scalar value to be written

$length
the maximum number of bytes to write

$offset
the location in $value where data is read from

Throws:

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

Servlet::Util::IndexOutOfBoundsException
if $buffer is specified as undef


SEE ALSO

the Servlet::ServletResponse manpage, the Servlet::Util::Exception manpage


AUTHOR

Brian Moseley, bcm@maz.org