Abstraction of input stream.
More...
#include <inputStream.hpp>
|
| InputStream (const std::string &docpath) |
| Constructor. More...
|
|
| ~InputStream () |
| Destructor. More...
|
|
std::size_t | read (char *buf, std::size_t bufsize) |
| Read some data. More...
|
|
const char * | readLine (char *buf, std::size_t bufsize, bool failOnNoLine=false) |
| Read a line. More...
|
|
std::size_t | readAhead (char *buf, std::size_t bufsize) |
| Read some data and keep it in a buffer for the next read. More...
|
|
unsigned int | error () const |
| Get the last error (system errno) occurred. More...
|
|
bool | eof () |
| Check if there is more data to read. More...
|
|
Abstraction of input stream.
strus::InputStream::InputStream |
( |
const std::string & |
docpath | ) |
|
|
explicit |
Constructor.
- Parameters
-
[in] | docpath | path to file to read or "-" for stdin |
strus::InputStream::~InputStream |
( |
| ) |
|
bool strus::InputStream::eof |
( |
| ) |
|
Check if there is more data to read.
unsigned int strus::InputStream::error |
( |
| ) |
const |
Get the last error (system errno) occurred.
- Returns
- the last error
std::size_t strus::InputStream::read |
( |
char * |
buf, |
|
|
std::size_t |
bufsize |
|
) |
| |
Read some data.
- Parameters
-
[in,out] | buf | where to write to |
[in] | bufsize | allocation size of 'buf' (capacity) |
- Returns
- the number of bytes read, 0 in case of EOF or an error occurred
std::size_t strus::InputStream::readAhead |
( |
char * |
buf, |
|
|
std::size_t |
bufsize |
|
) |
| |
Read some data and keep it in a buffer for the next read.
- Parameters
-
[in,out] | buf | where to write to |
[in] | bufsize | allocation size of 'buf' (capacity) |
- Returns
- the number of bytes read or 0 in case of EOF or an error occurred
const char* strus::InputStream::readLine |
( |
char * |
buf, |
|
|
std::size_t |
bufsize, |
|
|
bool |
failOnNoLine = false |
|
) |
| |
Read a line.
- Parameters
-
[in,out] | buf | where to write to |
[in] | bufsize | allocation size of 'buf' (capacity) |
[in] | failOnNoLine | true, if an error should be reported in case of buffer too small for line read |
- Returns
- pointer to the \0 terminated line read or NULL in case of no line to read left
The documentation for this class was generated from the following file: