OpenEnroth 73e68f7
|
#include <InputStream.h>
Public Member Functions | |
virtual | ~InputStream () |
virtual size_t | read (void *data, size_t size)=0 |
void | readOrFail (void *data, size_t size) |
std::string | readAll (size_t maxSize=-1) |
virtual size_t | skip (size_t size)=0 |
void | skipOrFail (size_t size) |
virtual void | close ()=0 |
virtual std::string | displayPath () const =0 |
Abstract base class for all data input streams.
Compared to std::istream
it is:
|
inlinevirtual |
|
pure virtual |
Closes this input stream. Reading from a closed stream will result in undefined behavior.
Does nothing if the stream is already closed.
Exception | On error. |
Implemented in detail::MemoryFileSystemInputStream, FFmpegBlobInputStream, BlobInputStream, FileInputStream, and MemoryInputStream.
|
pure virtual |
Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.
|
pure virtual |
data | Output buffer to write read data into. |
size | Number of bytes to read. |
size
signals end of stream. Exception | On error. |
Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.
std::string InputStream::readAll | ( | size_t | maxSize = -1 | ) |
Reads everything that's in this stream, up to maxSize
bytes.
maxSize | Maximal number of bytes to read from the stream. |
std::string
. Exception | On error. |
void InputStream::readOrFail | ( | void * | data, |
size_t | size | ||
) |
Reads the requested amount of data from the stream, or fails with an exception if unable to do so.
data | Output buffer to write read data into. |
size | Number of bytes to read. |
Exception | On error. |
|
pure virtual |
size | Number of bytes to skip. |
size
signals end of stream. Exception | On error. |
Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.
void InputStream::skipOrFail | ( | size_t | size | ) |
Same as readOrFail
, but for skipping bytes.
size | Number of bytes to skip. |
Exception | On error. |