OpenEnroth cf228e9
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
BlobInputStream Class Reference

#include <BlobInputStream.h>

Inheritance diagram for BlobInputStream:
InputStream detail::MemoryFileSystemInputStream

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
 

Detailed Description

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.

Member Typedef Documentation

◆ base_type

Constructor & Destructor Documentation

◆ BlobInputStream() [1/3]

BlobInputStream::BlobInputStream ( )
default

◆ BlobInputStream() [2/3]

BlobInputStream::BlobInputStream ( Blob &&  blob)
explicit

◆ BlobInputStream() [3/3]

BlobInputStream::BlobInputStream ( const Blob blob)
explicit

Member Function Documentation

◆ open() [1/2]

void BlobInputStream::open ( Blob &&  blob)

◆ open() [2/2]

void BlobInputStream::open ( const Blob blob)

◆ readAllAsBlob()

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.

Returns
Remaining stream data as a shared subblob. No copying occurs.

◆ readAsBlob()

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.

Parameters
sizeNumber of bytes to read.
Returns
Subblob of the blob that this stream is reading from. Actual size might be less than size if end of stream is encountered.

◆ readAsBlobOrFail()

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.

Parameters
sizeNumber of bytes to read.
Returns
Subblob of the blob that this stream is reading from.
Exceptions
ExceptionIf there is not enough data in the stream.

Member Data Documentation

◆ _blob

Blob BlobInputStream::_blob
private

The documentation for this class was generated from the following files: