Qore::OutputStream Class Referenceabstract

This class defines an abstract interface for output streams. More...

Inheritance diagram for Qore::OutputStream:
[legend]

## Public Member Functions

abstract nothing | bulkWrite (binary data, timeout timeout_ms=-1)
| Writes bytes to the input stream. More...
abstract nothing | close ()
| Closes the output stream and releases any resources. More...
| constructor ()
| Constructor. More...
abstract nothing | write (int value, timeout timeout_ms=-1)
| Writes a single byte to the output stream. More...

## Detailed Description

This class defines an abstract interface for output streams.

Classes inheriting this class can be used to write bytes to files, sockets, memory etc.

Since
  Qore 0.8.12

## Member Function Documentation

abstract nothing Qore::OutputStream::bulkWrite | ( | binary | data,
|  | timeout | timeout_ms = `-1`
| ) |  |

pure virtual

Writes bytes to the input stream.

Parameters

  data | the data to write
  timeout_ms | a timeout period with a resolution of milliseconds (a relative date/time value; integer arguments will be assumed to be milliseconds); if not given or negative the call will never time out

Example:
  os.write(<0405>);

Exceptions

  IO-ERROR | if an I/O error occurs
  TIMEOUT-ERROR | if the data could not be written in the specified timeout

Implemented in Qore::FileOutputStream, and Qore::BinaryOutputStream.

abstract nothing Qore::OutputStream::close | ( |  | ) |

pure virtual

Closes the output stream and releases any resources.

Any methods called on a closed output stream will thrown an IO-ERROR exception.

Exceptions

  IO-ERROR | if an I/O error occurs

Implemented in Qore::FileOutputStream, and Qore::BinaryOutputStream.

Qore::OutputStream::constructor | ( |  | ) |

Constructor.

Used by subclasses defined in the Qore programming language.

abstract nothing Qore::OutputStream::write | ( | int | value,
|  | timeout | timeout_ms = `-1`
| ) |  |

pure virtual

Writes a single byte to the output stream.

Parameters

  value | the byte (0 - 255) to write to the output stream, only the least significant 8 bits are used, the rest is ignored
  timeout_ms | a timeout period with a resolution of milliseconds (a relative date/time value; integer arguments will be assumed to be milliseconds); if not given or negative the call will never time out

Example:
  os.write(5);

Exceptions

  IO-ERROR | if an I/O error occurs
  TIMEOUT-ERROR | if the byte could no be written in the specified timeout

Implemented in Qore::BinaryOutputStream, and Qore::FileOutputStream.