InputStreamInterface Class Reference

#include <iostreams.h>

Inheritance diagram for InputStreamInterface:

Detailed Description

Interface for input streams. It allows to read data from streams. This interface needs to be implemented for each protocol.

Public Member Functions

MAXON_METHOD Result< Int64BytesAvailable () const
 
MAXON_FUNCTION Result< void > Read (const Block< Byte > &data)
 
MAXON_METHOD Result< IntReadEOS (const Block< Byte > &data)
 
MAXON_METHOD Result< void > Skip (Int64 bytes)
 
 MAXON_DECLARATION_CLASS (Factory< InputStreamRef(const Block< const Char > &, Bool)>, FromBlock, "net.maxon.inputstreaminterface.fromblock")
 

Private Member Functions

 MAXON_INTERFACE (InputStreamInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.inputstream")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( InputStreamInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.inputstream"   
)
private

◆ BytesAvailable()

MAXON_METHOD Result<Int64> BytesAvailable ( ) const

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.

Returns
Available number of bytes to read/skip.

◆ Read()

MAXON_FUNCTION Result<void> Read ( const Block< Byte > &  data)

Reads all bytes up to len bytes of data from the input stream into an array of bytes. 'bytes' and the result are of type Int (not Int64) as 'buffer' can never hold more bytes on a 32-bit system.

Parameters
[out]dataBuffer which receives the read bytes.
Returns
OK if all bytes could be read.

◆ ReadEOS()

MAXON_METHOD Result<Int> ReadEOS ( const Block< Byte > &  data)

Reads up to len bytes of data from the input stream into an array of bytes. 'bytes' and the result are of type Int (not Int64) as 'buffer' can never hold more bytes on a 32-bit system.

Parameters
[out]dataBuffer which receives the read bytes.
Returns
Number of bytes that has been read. If less bytes read than requested the end of the stream has been reached.

◆ Skip()

MAXON_METHOD Result<void> Skip ( Int64  bytes)

Skips over and discards n bytes of data from this input stream. If you want to Seek() forward Skip is the preferred method to call from the performance perspective.

Parameters
[in]bytesNumber of bytes to skip from the current position.
Returns
OK on success.

◆ MAXON_DECLARATION_CLASS()

MAXON_DECLARATION_CLASS ( Factory< InputStreamRef(const Block< const Char > &, Bool)>  ,
FromBlock  ,
"net.maxon.inputstreaminterface.fromblock"   
)