#include <IInputStream.h>
|
virtual void | read (std::size_t numBytes, std::byte *out_bytes)=0 |
| Read specific number of raw bytes in one go. The method does not return before finishing the reading process.
|
|
virtual void | readString (std::string *out_string, char delimiter)=0 |
| Read a string in one go. Note the EOF is also considered a delimiter (the final one).
|
|
virtual void | seekGet (std::size_t pos)=0 |
| Set the input position of the stream. The unit of the position is defined by the implementation.
|
|
virtual std::optional< std::size_t > | tellGet ()=0 |
| Get the current input position of the stream. The unit of the position is defined by the implementation.
|
|
| operator bool () const override=0 |
|
virtual std::size_t | readSome (std::size_t numBytes, std::byte *out_bytes) |
| Read some data in the form of raw bytes. The method may return before finish reading all bytes. In such case, the method returns how many bytes were actually read.
|
|
void | readLine (std::string *out_string) |
| Read a line. Equivalent to calling readString(std::string*, char) with '
' as the delimiter.
|
|
virtual | ~IDataStream ()=default |
|
virtual std::string | acquireName () const |
| Access to the stream's name. This method is not meant to be used in a high performance context, unless otherwise stated by the overridder. Stream name is not always available.
|
|
◆ operator bool()
ph::IInputStream::operator bool |
( |
| ) |
const |
|
overridepure virtual |
◆ read()
virtual void ph::IInputStream::read |
( |
std::size_t | numBytes, |
|
|
std::byte * | out_bytes ) |
|
pure virtual |
Read specific number of raw bytes in one go. The method does not return before finishing the reading process.
- Parameters
-
| numBytes | Number of bytes to read. |
[out] | out_bytes | The read bytes. Must contain storage for at least numBytes bytes. |
- Exceptions
-
IOException | If the read operation failed. |
Implemented in ph::ByteBufferInputStream, ph::FilteredInputStream, and ph::StdInputStream.
◆ readLine()
void ph::IInputStream::readLine |
( |
std::string * | out_string | ) |
|
|
inline |
Read a line. Equivalent to calling readString(std::string*, char) with '
' as the delimiter.
- Parameters
-
[out] | out_string | The read string. Does not include the new-line character. |
- Exceptions
-
IOException | If the read operation failed. |
◆ readSome()
std::size_t ph::IInputStream::readSome |
( |
std::size_t | numBytes, |
|
|
std::byte * | out_bytes ) |
|
inlinevirtual |
Read some data in the form of raw bytes. The method may return before finish reading all bytes. In such case, the method returns how many bytes were actually read.
- Parameters
-
| numBytes | Maximum number of bytes to read. |
[out] | out_bytes | The read bytes. Must contain storage for at least numBytes bytes. |
- Returns
- How many bytes were actually read.
- Exceptions
-
IOException | If the read operation failed. |
Reimplemented in ph::ByteBufferInputStream, and ph::StdInputStream.
◆ readString()
virtual void ph::IInputStream::readString |
( |
std::string * | out_string, |
|
|
char | delimiter ) |
|
pure virtual |
Read a string in one go. Note the EOF is also considered a delimiter (the final one).
- Parameters
-
out_string | The read string. Does not include the delimiter . |
delimiter | The character that denotes the ending of a line. |
- Exceptions
-
IOException | If the read operation failed. |
Implemented in ph::ByteBufferInputStream, and ph::StdInputStream.
◆ seekGet()
virtual void ph::IInputStream::seekGet |
( |
std::size_t | pos | ) |
|
|
pure virtual |
◆ tellGet()
virtual std::optional< std::size_t > ph::IInputStream::tellGet |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: