AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Aws::Crt::Io::InputStream Class Referenceabstract

#include <Stream.h>

Inheritance diagram for Aws::Crt::Io::InputStream:
Aws::Crt::RefCounted< InputStream > Aws::Crt::Io::StdIOStreamInputStream

Public Member Functions

virtual ~InputStream ()
 
 InputStream (const InputStream &)=delete
 
InputStreamoperator= (const InputStream &)=delete
 
 InputStream (InputStream &&)=delete
 
InputStreamoperator= (InputStream &&)=delete
 
 operator bool () const noexcept
 
virtual bool IsValid () const noexcept=0
 
bool Read (ByteBuf &dest)
 
bool Seek (int64_t offset, StreamSeekBasis seekBasis)
 
bool GetStatus (StreamStatus &status)
 
bool GetLength (int64_t &length)
 

Protected Member Functions

 InputStream (Aws::Crt::Allocator *allocator=ApiAllocator())
 
virtual bool ReadImpl (ByteBuf &buffer) noexcept=0
 
virtual bool ReadSomeImpl (ByteBuf &buffer) noexcept=0
 
virtual StreamStatus GetStatusImpl () const noexcept=0
 
virtual int64_t GetLengthImpl () const noexcept=0
 
virtual bool SeekImpl (int64_t offset, StreamSeekBasis seekBasis) noexcept=0
 
virtual int64_t PeekImpl () const noexcept=0
 
- Protected Member Functions inherited from Aws::Crt::RefCounted< InputStream >
 RefCounted ()
 
 ~RefCounted ()
 
void AcquireRef ()
 
void ReleaseRef ()
 

Protected Attributes

Allocatorm_allocator
 
aws_input_stream m_underlying_stream
 

Constructor & Destructor Documentation

◆ ~InputStream()

Aws::Crt::Io::InputStream::~InputStream ( )
virtual

◆ InputStream() [1/3]

Aws::Crt::Io::InputStream::InputStream ( const InputStream )
delete

◆ InputStream() [2/3]

Aws::Crt::Io::InputStream::InputStream ( InputStream &&  )
delete

◆ InputStream() [3/3]

Aws::Crt::Io::InputStream::InputStream ( Aws::Crt::Allocator allocator = ApiAllocator())
protected

Member Function Documentation

◆ GetLength()

bool Aws::Crt::Io::InputStream::GetLength ( int64_t &  length)
inline

Gets the stream's length. Some streams may not be able to answer this.

Parameters
lengthoutput parameter for the length of the stream
Returns
success/failure

◆ GetLengthImpl()

virtual int64_t Aws::Crt::Io::InputStream::GetLengthImpl ( ) const
protectedpure virtualnoexcept
Returns
the total length of the available data for the stream.
-1 if not available.

Implemented in Aws::Crt::Io::StdIOStreamInputStream.

◆ GetStatus()

bool Aws::Crt::Io::InputStream::GetStatus ( StreamStatus status)
inline

Gets the stream's current status

Parameters
statusoutput parameter for the stream's status
Returns
success/failure

◆ GetStatusImpl()

virtual StreamStatus Aws::Crt::Io::InputStream::GetStatusImpl ( ) const
protectedpure virtualnoexcept
Returns
the current status of the stream.

Implemented in Aws::Crt::Io::StdIOStreamInputStream.

◆ IsValid()

virtual bool Aws::Crt::Io::InputStream::IsValid ( ) const
pure virtualnoexcept
Returns
true/false if this object is in a valid state

Implemented in Aws::Crt::Io::StdIOStreamInputStream.

◆ operator bool()

Aws::Crt::Io::InputStream::operator bool ( ) const
inlineexplicitnoexcept

◆ operator=() [1/2]

InputStream& Aws::Crt::Io::InputStream::operator= ( const InputStream )
delete

◆ operator=() [2/2]

InputStream& Aws::Crt::Io::InputStream::operator= ( InputStream &&  )
delete

◆ PeekImpl()

virtual int64_t Aws::Crt::Io::InputStream::PeekImpl ( ) const
protectedpure virtualnoexcept

Peeks the stream

Essentially calls peek on the underlying istream

Returns
return value of the underlying istream::peek

Implemented in Aws::Crt::Io::StdIOStreamInputStream.

◆ Read()

bool Aws::Crt::Io::InputStream::Read ( ByteBuf dest)
inline

Reads data from the stream into a buffer

Parameters
destbuffer to add the read data into
Returns
success/failure

◆ ReadImpl()

virtual bool Aws::Crt::Io::InputStream::ReadImpl ( ByteBuf buffer)
protectedpure virtualnoexcept

◆ ReadSomeImpl()

virtual bool Aws::Crt::Io::InputStream::ReadSomeImpl ( ByteBuf buffer)
protectedpure virtualnoexcept

◆ Seek()

bool Aws::Crt::Io::InputStream::Seek ( int64_t  offset,
StreamSeekBasis  seekBasis 
)
inline

Moves the head of the stream to a new location

Parameters
offsethow far to move, in bytes
seekBasiswhat direction to move the head of stream
Returns
success/failure

◆ SeekImpl()

virtual bool Aws::Crt::Io::InputStream::SeekImpl ( int64_t  offset,
StreamSeekBasis  seekBasis 
)
protectedpure virtualnoexcept

Seek's the stream to seekBasis based offset bytes.

It is expected, that if seeking to the beginning of a stream, all error's are cleared if possible.

Returns
true on success, false otherwise. You SHOULD raise an error via aws_raise_error() if a failure occurs.

Member Data Documentation

◆ m_allocator

Allocator* Aws::Crt::Io::InputStream::m_allocator
protected

◆ m_underlying_stream

aws_input_stream Aws::Crt::Io::InputStream::m_underlying_stream
protected

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