OpenEnroth 73e68f7
|
#include <BlobInputStream.h>
Public Member Functions | |
BlobInputStream ()=default | |
BlobInputStream (Blob &&blob) | |
BlobInputStream (const Blob &blob) | |
void | open (Blob &&blob) |
void | open (const Blob &blob) |
virtual size_t | read (void *data, size_t size) override |
virtual size_t | skip (size_t size) override |
virtual void | close () override |
virtual std::string | displayPath () const override |
void | seek (ssize_t pos) |
ssize_t | position () const |
ssize_t | size () const |
Blob | tail () const |
Blob | readBlob (size_t size) |
Blob | readBlobOrFail (size_t size) |
Public Member Functions inherited from InputStream | |
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 |
Private Member Functions | |
size_t | remaining () const |
Private Attributes | |
Blob | _blob |
const char * | _pos = nullptr |
const char * | _end = nullptr |
Input stream that reads from a Blob
.
Besides the InputStream
interface, this class also offers an interface for reading subblobs which share memory with the source blob, and thus no memory copying occurs.
|
default |
|
explicit |
|
explicit |
|
overridevirtual |
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. |
Implements InputStream.
Reimplemented in detail::MemoryFileSystemInputStream, and FFmpegBlobInputStream.
|
overridevirtual |
Implements InputStream.
void BlobInputStream::open | ( | Blob && | blob | ) |
void BlobInputStream::open | ( | const Blob & | blob | ) |
ssize_t BlobInputStream::position | ( | ) | const |
|
overridevirtual |
data | Output buffer to write read data into. |
size | Number of bytes to read. |
size
signals end of stream. Exception | On error. |
Implements InputStream.
Blob BlobInputStream::readBlob | ( | size_t | size | ) |
Same as read
, but returns the data as a blob that's shared with the blob that this stream is reading from.
This basically presents a way to conveniently cut a blob into subblobs using a streaming interface.
size | Number of bytes to read. |
size
if end of stream is encountered. Blob BlobInputStream::readBlobOrFail | ( | size_t | size | ) |
Same as readOrFail
, but returns the data as a blob that's shared with the blob that this stream is reading from.
size | Number of bytes to read. |
Exception | If there is not enough data in the stream. |
|
private |
void BlobInputStream::seek | ( | ssize_t | pos | ) |
ssize_t BlobInputStream::size | ( | ) | const |
|
overridevirtual |
size | Number of bytes to skip. |
size
signals end of stream. Exception | On error. |
Implements InputStream.
Blob BlobInputStream::tail | ( | ) | const |
|
private |
|
private |
|
private |