StreamReader implements buffered reads from IO objects.
More...
#include <Stream.h>
- See also
- See examples/src/support.cpp compareTXTFiles() for an example of reading a file.
Definition at line 75 of file Stream.h.
§ ~StreamReader()
StreamReader::~StreamReader |
( |
void |
| ) |
|
§ StreamReader()
StreamReader::StreamReader |
( |
void |
| ) |
|
§ close()
void StreamReader::close |
( |
void |
| ) |
|
This method closes the underlying IO object.
§ flush()
void StreamReader::flush |
( |
void |
| ) |
|
This method disregard any data in the buffer and causes the next read() to get dat from the underlying IO object.
§ get_be()
template<typename TYPE >
bool StreamReader::get_be |
( |
TYPE & |
value | ) |
|
|
inline |
This method reads sizeof(TYPE) bytes and endian swaps as needed.
- Parameters
-
- Returns
- true for success
Definition at line 179 of file Stream.h.
References HOST_IS_LITTLE_ENDIAN.
§ get_le()
template<typename TYPE >
bool StreamReader::get_le |
( |
TYPE & |
value | ) |
|
|
inline |
This method reads sizeof(TYPE) bytes and endian swaps as needed.
- Parameters
-
- Returns
- true for success
Definition at line 163 of file Stream.h.
References HOST_IS_BIG_ENDIAN.
§ get_str()
bool StreamReader::get_str |
( |
char *& |
line, |
|
|
size_t & |
length |
|
) |
| |
This method reads the next line of the file. It uses '
' as the line terminator. This method also allocates memory as needed and it is the responsible of the caller to DEALLOC() the returned line buffer.
- Parameters
-
line | pointer to the line buffer |
length | the length of the line buffer |
- Returns
- true for success
§ init() [1/2]
This method binds the stream to a IO object.
- Parameters
-
io | the source IO object |
open | if true init() will call open() |
bufferSize | the buffer size that is passed to open() |
§ init() [2/2]
This method binds the stream to a IO object and seeks to the given offset.
- Parameters
-
location | the source IO object and the begining offset |
bufferSize | the buffer size that is passed to open() |
§ open()
This method opens the underlying IO object.
- Parameters
-
bufferSize | the size of buffered reads |
§ read()
size_t StreamReader::read |
( |
void * |
buf, |
|
|
size_t |
nbytes |
|
) |
| |
This method reads nbytes into the given buffer.
- Parameters
-
buf | the destination buffer |
nbytes | the number of bytes to read |
- Returns
- the number bytes actually read
§ seek()
This method sets the file offset. See Mode for offset origin.
- Parameters
-
offset | number bytes to move |
whence | the origin of movement |
§ tell()
This method get the current file offset.
The documentation for this class was generated from the following file: