Qore::BinaryOutputStream Class Reference

This class implements the OutputStream interface for writing bytes to a Binary buffer. More...

Inheritance diagram for Qore::BinaryOutputStream:
[legend]

## Public Member Functions

nothing | bulkWrite (binary data, timeout timeout_ms=-1)
| Writes bytes to the input stream. More...
nothing | close ()
| Closes the output stream and releases any resources. More...
| constructor ()
| Creates the BinaryOutputStream.
binary | getData ()
| Returns the data written to the stream, clearing the internal buffer. More...
nothing | write (int value, timeout timeout_ms=-1)
| Writes a single byte to the output stream. More...
Public Member Functions inherited from Qore::OutputStream
| constructor ()
| Constructor. More...

## Detailed Description

This class implements the OutputStream interface for writing bytes to a Binary buffer.

Since
  Qore 0.8.12

Example: BinaryOutputStream basic usage
  BinaryOutputStream bos();
  bos.bulkWrite(<0405>);
  bos.write(6);
  bos.getData(); # returns <040506>

## Member Function Documentation

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

virtual

Writes bytes to the input stream.

Parameters

  data | the data to write
  timeout_ms | ignored

Example:
  BinaryOutputStream bos();
  bos.bulkWrite(<0405>);
  bos.bulkWrite(<06>);
  bos.getData(); # returns <040506>

Implements Qore::OutputStream.

nothing Qore::BinaryOutputStream::close | ( |  | ) |

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

Implements Qore::OutputStream.

binary Qore::BinaryOutputStream::getData | ( |  | ) |

Returns the data written to the stream, clearing the internal buffer.

Returns
  the data written to the BinaryOutputStream

Example:
  BinaryOutputStream bos();
  bos.bulkWrite(<0405>);
  bos.write(6);
  bos.getData(); # returns <040506>

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

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 | ignored

Example:
  BinaryOutputStream bos();
  bos.write(4);
  bos.write(5);
  bos.write(6);
  bos.getData(); # returns <040506>

Implements Qore::OutputStream.