AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
IInputStream Class Referenceabstract

Represents an input stream. More...

#include <AUI/IO/IInputStream.h>

Public Member Functions

virtual size_t read (char *dst, size_t size)=0
 Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.
 
size_t read (std::span< std::byte > destination)
 Reads up to destination.size() bytes from stream. Blocking (waiting for new data) is allowed.
 
void readExact (char *dst, size_t size)
 Reads exact size bytes from stream. Blocking (waiting for new data) is allowed.
 
template<typename T>
deserialize ()
 
template<typename T>
IInputStreamoperator>> (T &dst)
 
template<typename T>
IInputStreamoperator>> (T &&dst)
 

Detailed Description

Represents an input stream.

Member Function Documentation

◆ deserialize()

template<typename T>
T IInputStream::deserialize ( )
inline

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Returns
result value

◆ operator>>() [1/2]

template<typename T>
IInputStream & IInputStream::operator>> ( T && dst)

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Parameters
dstvalue to write

◆ operator>>() [2/2]

template<typename T>
IInputStream & IInputStream::operator>> ( T & dst)

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Parameters
dstvalue to write

◆ read() [1/2]

virtual size_t IInputStream::read ( char * dst,
size_t size )
pure virtual

Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstdestination buffer
sizedestination buffer's size. > 0
Returns
number of read bytes (including 0)

Implemented in AByteBufferInputStream, AConcatInputStream, ADynamicPipe, AFileInputStream, ALimitedInputStream, APipe, ARandomInputStream, AStringStream, AStrongByteBufferInputStream, ATcpSocket, and PipeInputStream.

◆ read() [2/2]

size_t IInputStream::read ( std::span< std::byte > destination)
inline

Reads up to destination.size() bytes from stream. Blocking (waiting for new data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
destinationdestination buffer
Returns
number of read bytes (including 0)

◆ readExact()

void IInputStream::readExact ( char * dst,
size_t size )
inline

Reads exact size bytes from stream. Blocking (waiting for new data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Exceptions
ThrowsAEOFException when could not read EXACT size bytes.
Parameters
dstdestination buffer.
sizedestination buffer's size.

The documentation for this class was generated from the following file:
Inheritance diagram for IInputStream: