StreamWriter implements buffered writes to IO objects.
More...
#include <Stream.h>
Definition at line 204 of file Stream.h.
StreamWriter::~StreamWriter |
( |
void |
| ) |
|
StreamWriter::StreamWriter |
( |
void |
| ) |
|
void StreamWriter::close |
( |
bool |
doFlush = true | ) |
|
This method flushs any buffered data if doFlush is true and then closes the underlying IO object.
This method copies length bytes for io at offset.
- Parameters
-
io | the source IO object |
offset | the byte offset to source data |
length | the number of bytes to copy |
- Returns
- true for success
This method copies the data pointed to by location.
- Parameters
-
location | the location of the data |
- Returns
- true for success
This method copies the next length bytes from stream
- Parameters
-
stream | the source stream |
length | the number of bytes to copy |
- Returns
- true for success
void StreamWriter::flush |
( |
void |
| ) |
|
This method wirtes any buffered data to the IO object.
This method binds the stream to a IO object.
- Parameters
-
io | the destination IO object |
open | if true init() will call open() |
bufferSize | the buffer size that is passed to open() |
This method opens the underlying IO object,
- Parameters
-
bufferSize | the size of buffered writes |
template<typename TYPE >
bool StreamWriter::put_be |
( |
TYPE |
value | ) |
|
|
inline |
template<typename TYPE >
bool StreamWriter::put_le |
( |
TYPE |
value | ) |
|
|
inline |
This method writes sizeof(TYPE) bytes in little endian format.
- Parameters
-
- Returns
- true for success
Definition at line 283 of file Stream.h.
References HOST_IS_BIG_ENDIAN, and write().
bool StreamWriter::put_str |
( |
const char * |
str, |
|
|
size_t |
length = static_cast< size_t >(-1) |
|
) |
| |
This method writes the string with given length.
- Parameters
-
str | the source string |
length | the number of bytes to write if length is -1 put_str() uses the null terminator length. |
- Returns
- true for success
This method flushs any beffered data then sets the file offset. See Mode for offset origin.
- Parameters
-
offset | number bytes to move |
whence | the origin of movement |
This method get the current file offset.
size_t StreamWriter::write |
( |
const void * |
buf, |
|
|
size_t |
nbytes |
|
) |
| |
This method writes nbytes from the given buffer.
- Parameters
-
buf | the source buffer |
nbytes | the number of bytes to write |
- Returns
- the number bytes actually written
Referenced by put_be(), and put_le().
The documentation for this class was generated from the following file: