Qore Programming Language Reference Manual  0.8.12
Qore::BinaryOutputStream Class Reference

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

Inheritance diagram for Qore::BinaryOutputStream:

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
1 BinaryOutputStream bos();
2 bos.bulkWrite(<0405>);
3 bos.write(6);
4 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
datathe data to write
timeout_msignored
Example:
1 BinaryOutputStream bos();
2 bos.bulkWrite(<0405>);
3 bos.bulkWrite(<06>);
4 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-ERRORif 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:
1 BinaryOutputStream bos();
2 bos.bulkWrite(<0405>);
3 bos.write(6);
4 bos.getData(); # returns <040506>
nothing Qore::BinaryOutputStream::write ( int  value,
timeout  timeout_ms = -1 
)
virtual

Writes a single byte to the output stream.

Parameters
valuethe byte (0 - 255) to write to the output stream, only the least significant 8 bits are used, the rest is ignored
timeout_msignored
Example:
1 BinaryOutputStream bos();
2 bos.write(4);
3 bos.write(5);
4 bos.write(6);
5 bos.getData(); # returns <040506>

Implements Qore::OutputStream.