A concrete implementation of OutputStream that performs output operations to an in-memory buffer.
More...
#include <bond/io/memoryoutputstream.h>
|
| | MemoryOutputStream (void *buffer, pos_t size) |
| | Constructs a MemoryOutputStream object.
|
| virtual | ~MemoryOutputStream () |
| virtual void | VPrint (const char *format, va_list argList) override |
| | Writes formatted output to the stream using a variable argument list.
|
| virtual void | Write (const uint8_t *bytes, size_t numBytes) override |
| | Writes a sequence of bytes to the stream.
|
| virtual void | Write (uint8_t c) override |
| | Writes a single byte to the stream.
|
| virtual pos_t | GetPosition () const override |
| | Returns the current position within the stream.
|
| virtual pos_t | GetEndPosition () const override |
| | Returns the end position of the stream.
|
| virtual void | SetPosition (off_t offset) override |
| | Sets the current position within the stream.
|
| virtual void | SetPositionFromEnd (off_t offset) override |
| | Sets the current position relative to the end of the stream.
|
| virtual void | AddOffset (off_t offset) override |
| | Advances the current position by the given offset.
|
| virtual bool | IsEof () const override |
| | Tests whether the current position is at or beyond the end of the stream.
|
| virtual bool | HasError () const override |
| | Tests whether the stream is currently in an error state.
|
| virtual void | ClearError () override |
| | Clears the current error state of the stream.
|
| virtual | ~OutputStream () |
| | Destroys an OutputStream object.
|
| virtual void | Flush () |
| | Flushes any buffered output.
|
| virtual void | Print (const char *format,...) |
| | Writes formatted output to the stream.
|
| virtual | ~Stream () |
| | Destroys a Stream object.
|
| virtual void | Close () |
| | Closes the stream.
|
|
| typedef long | pos_t |
| | A type used to represent absolute positions within a stream.
|
| typedef long | off_t |
| | A type used to represent relative offsets within a stream.
|
| static const int | Eof = -1 |
| | A special value returned by single-byte input functions to indicate end of stream.
|
A concrete implementation of OutputStream that performs output operations to an in-memory buffer.
MemoryOutputStream provides a non-owning view over a writable memory buffer and writes data to that buffer without reallocating it.
- See also
- MemoryInputStream, OutputStream
◆ MemoryOutputStream()
| Bond::MemoryOutputStream::MemoryOutputStream |
( |
void * | buffer, |
|
|
pos_t | size ) |
Constructs a MemoryOutputStream object.
- Parameters
-
| buffer | A pointer to the memory buffer to which bytes will be written. The buffer is not copied and must remain valid for the lifetime of the MemoryOutputStream. |
| size | The size of the memory buffer, in bytes. |
◆ ~MemoryOutputStream()
| virtual Bond::MemoryOutputStream::~MemoryOutputStream |
( |
| ) |
|
|
inlinevirtual |
◆ AddOffset()
| virtual void Bond::MemoryOutputStream::AddOffset |
( |
off_t | offset | ) |
|
|
overridevirtual |
Advances the current position by the given offset.
- Parameters
-
| offset | The signed amount by which the current position should be adjusted. |
Implements Bond::Stream.
◆ ClearError()
| virtual void Bond::MemoryOutputStream::ClearError |
( |
| ) |
|
|
inlineoverridevirtual |
Clears the current error state of the stream.
Implements Bond::Stream.
◆ GetEndPosition()
| virtual pos_t Bond::MemoryOutputStream::GetEndPosition |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the end position of the stream.
- Returns
- The absolute position one past the last byte in the stream.
Implements Bond::Stream.
◆ GetPosition()
| virtual pos_t Bond::MemoryOutputStream::GetPosition |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the current position within the stream.
- Returns
- The current absolute stream position.
Implements Bond::Stream.
◆ HasError()
| virtual bool Bond::MemoryOutputStream::HasError |
( |
| ) |
const |
|
inlineoverridevirtual |
Tests whether the stream is currently in an error state.
- Returns
- True if an error has occurred on the underlying stream.
Implements Bond::Stream.
◆ IsEof()
| virtual bool Bond::MemoryOutputStream::IsEof |
( |
| ) |
const |
|
inlineoverridevirtual |
Tests whether the current position is at or beyond the end of the stream.
- Returns
- True if no more data can be read or written at the current position.
Implements Bond::Stream.
◆ SetPosition()
| virtual void Bond::MemoryOutputStream::SetPosition |
( |
off_t | offset | ) |
|
|
overridevirtual |
Sets the current position within the stream.
- Parameters
-
| offset | The absolute position to which the stream should be moved. |
Implements Bond::Stream.
◆ SetPositionFromEnd()
| virtual void Bond::MemoryOutputStream::SetPositionFromEnd |
( |
off_t | offset | ) |
|
|
overridevirtual |
Sets the current position relative to the end of the stream.
- Parameters
-
| offset | The offset from the end position to which the stream should be moved. |
Implements Bond::Stream.
◆ VPrint()
| virtual void Bond::MemoryOutputStream::VPrint |
( |
const char * | format, |
|
|
va_list | argList ) |
|
overridevirtual |
Writes formatted output to the stream using a variable argument list.
- Parameters
-
| format | A printf-style format string describing the text to be written. |
| argList | A variable argument list containing the values to be formatted. |
Implements Bond::OutputStream.
◆ Write() [1/2]
| virtual void Bond::MemoryOutputStream::Write |
( |
const uint8_t * | bytes, |
|
|
size_t | numBytes ) |
|
overridevirtual |
Writes a sequence of bytes to the stream.
- Parameters
-
| bytes | The buffer containing the bytes to be written. |
| numBytes | The number of bytes to write. |
Reimplemented from Bond::OutputStream.
◆ Write() [2/2]
| virtual void Bond::MemoryOutputStream::Write |
( |
uint8_t | byte | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file:
- include/bond/io/memoryoutputstream.h