OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
InputStream Class Referenceabstract

#include <InputStream.h>

Inheritance diagram for InputStream:
BlobInputStream FileInputStream MemoryInputStream FFmpegBlobInputStream detail::MemoryFileSystemInputStream

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
 

Detailed Description

Abstract base class for all data input streams.

Compared to std::istream it is:

Constructor & Destructor Documentation

◆ ~InputStream()

virtual InputStream::~InputStream ( )
inlinevirtual

Member Function Documentation

◆ close()

virtual void InputStream::close ( )
pure virtual

Closes this input stream. Reading from a closed stream will result in undefined behavior.

Does nothing if the stream is already closed.

Exceptions
ExceptionOn error.

Implemented in detail::MemoryFileSystemInputStream, FFmpegBlobInputStream, BlobInputStream, FileInputStream, and MemoryInputStream.

◆ displayPath()

virtual std::string InputStream::displayPath ( ) const
pure virtual
Returns
Path to the file or resource being read, to be used for debugging and error reporting.

Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.

◆ read()

virtual size_t InputStream::read ( void *  data,
size_t  size 
)
pure virtual
Parameters
dataOutput buffer to write read data into.
sizeNumber of bytes to read.
Returns
Number of bytes actually read. A return value that's less than size signals end of stream.
Exceptions
ExceptionOn error.

Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.

◆ readAll()

std::string InputStream::readAll ( size_t  maxSize = -1)

Reads everything that's in this stream, up to maxSize bytes.

Parameters
maxSizeMaximal number of bytes to read from the stream.
Returns
Data read from the stream, as std::string.
Exceptions
ExceptionOn error.

◆ readOrFail()

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.

Parameters
dataOutput buffer to write read data into.
sizeNumber of bytes to read.
Exceptions
ExceptionOn error.

◆ skip()

virtual size_t InputStream::skip ( size_t  size)
pure virtual
Parameters
sizeNumber of bytes to skip.
Returns
Number of bytes actually skipped. A return value that's less than size signals end of stream.
Exceptions
ExceptionOn error.

Implemented in BlobInputStream, FileInputStream, and MemoryInputStream.

◆ skipOrFail()

void InputStream::skipOrFail ( size_t  size)

Same as readOrFail, but for skipping bytes.

Parameters
sizeNumber of bytes to skip.
Exceptions
ExceptionOn error.

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