MrSID Decode SDK for LiDAR Reference Manual
1.1.4.4709
|
StreamReader implements buffered reads from IO objects. More...
#include <Stream.h>
Public Member Functions | |
~StreamReader (void) | |
StreamReader (void) | |
void | init (IO *io, bool open, size_t bufferSize=DefaultBufferSize) |
Initalize the reader. | |
void | init (const IO::Location &location, size_t bufferSize=DefaultBufferSize) |
Initalize the reader. | |
void | open (size_t bufferSize=DefaultBufferSize) |
Open the IO object. | |
void | close (void) |
Close the IO object. | |
void | flush (void) |
Flush the memory buffer. | |
void | seek (offset_type offset, Mode whence) |
Set the file offset. | |
offset_type | tell (void) |
Get the current file offset. | |
size_t | read (void *buf, size_t nbytes) |
Read data. | |
template<typename TYPE > | |
bool | get_le (TYPE &value) |
Read little endian data. | |
template<typename TYPE > | |
bool | get_be (TYPE &value) |
Read big endian data. | |
bool | get_str (char *&line, size_t &length) |
Read the next line of text. |
StreamReader::~StreamReader | ( | void | ) |
StreamReader::StreamReader | ( | void | ) |
void StreamReader::close | ( | void | ) |
This method closes the underlying IO object.
void StreamReader::flush | ( | void | ) |
bool StreamReader::get_be | ( | TYPE & | value | ) | [inline] |
This method reads sizeof(TYPE) bytes and endian swaps as needed.
value | the destination |
Definition at line 179 of file Stream.h.
References HOST_IS_LITTLE_ENDIAN, and read().
bool StreamReader::get_le | ( | TYPE & | value | ) | [inline] |
This method reads sizeof(TYPE) bytes and endian swaps as needed.
value | the destination |
Definition at line 163 of file Stream.h.
References HOST_IS_BIG_ENDIAN, and read().
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.
line | pointer to the line buffer |
length | the length of the line buffer |
void StreamReader::init | ( | IO * | io, |
bool | open, | ||
size_t | bufferSize = DefaultBufferSize |
||
) |
void StreamReader::init | ( | const IO::Location & | location, |
size_t | bufferSize = DefaultBufferSize |
||
) |
void StreamReader::open | ( | size_t | bufferSize = DefaultBufferSize | ) |
This method opens the underlying IO object.
bufferSize | the size of buffered reads |
size_t StreamReader::read | ( | void * | buf, |
size_t | nbytes | ||
) |
void StreamReader::seek | ( | offset_type | offset, |
Mode | whence | ||
) |
This method sets the file offset. See Mode for offset origin.
offset | number bytes to move |
whence | the origin of movement |
offset_type StreamReader::tell | ( | void | ) |
This method get the current file offset.