|
OpenEnroth cf228e9
|
#include <BlobInputStream.h>
Public Member Functions | |
| BlobInputStream ()=default | |
| BlobInputStream (Blob &&blob) | |
| BlobInputStream (const Blob &blob) | |
| void | open (Blob &&blob) |
| void | open (const Blob &blob) |
| Blob | readAsBlob (size_t size) |
| Blob | readAsBlobOrFail (size_t size) |
| Blob | readAllAsBlob () |
Public Member Functions inherited from InputStream | |
| virtual | ~InputStream () |
| size_t | read (void *data, size_t size) |
| void | readOrFail (void *data, size_t size) |
| size_t | readAll (std::string *dst) |
| std::string | readAll () |
| size_t | skip (size_t size) |
| void | skipOrFail (size_t size) |
| size_t | readUntil (char delimiter, std::string *dst) |
| std::string | readUntil (char delimiter) |
| void | close () |
| bool | isOpen () const |
| size_t | position () const |
| size_t | size () const |
| const std::string & | displayPath () const |
Private Types | |
| using | base_type = InputStream |
Private Attributes | |
| Blob | _blob |
Additional Inherited Members | |
Public Types inherited from InputStream | |
| using | Buffer = StreamBuffer< const char > |
Protected Member Functions inherited from InputStream | |
| InputStream ()=default | |
| void | open (Buffer buffer, size_t size, std::string_view displayPath) |
| virtual size_t | _underflow (void *data, size_t size, Buffer *buffer) |
| virtual void | _close () |
| void | throwReadError (size_t requested, size_t actual) const |
| void | throwSkipError (size_t requested, size_t actual) const |
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.
|
private |
|
default |
|
explicit |
|
explicit |
| void BlobInputStream::open | ( | Blob && | blob | ) |
| void BlobInputStream::open | ( | const Blob & | blob | ) |
| Blob BlobInputStream::readAllAsBlob | ( | ) |
Same as readAll, but returns the data as a blob that's shared with the blob that this stream is reading from.
| Blob BlobInputStream::readAsBlob | ( | 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::readAsBlobOrFail | ( | 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 |