byteme
Read/write bytes from various sources
Loading...
Searching...
No Matches
byteme::RawBufferReader Class Referencefinal

Read bytes from a raw buffer, usually text. More...

#include <RawBufferReader.hpp>

Inheritance diagram for byteme::RawBufferReader:
Collaboration diagram for byteme::RawBufferReader:

Public Member Functions

 RawBufferReader (const unsigned char *buffer, std::size_t length)
 
std::size_t read (unsigned char *buffer, std::size_t n)
 
- Public Member Functions inherited from byteme::Reader

Detailed Description

Read bytes from a raw buffer, usually text.

This is a wrapper around an input buffer, provided for consistency with the other *Reader classes.

Constructor & Destructor Documentation

◆ RawBufferReader()

byteme::RawBufferReader::RawBufferReader ( const unsigned char * buffer,
std::size_t length )
inline
Parameters
[in]bufferPointer to an array of bytes. We assume that the lifetime of the array exceeds the lifetime of this RawBufferReader instance.
lengthLength of the buffer.

Member Function Documentation

◆ read()

std::size_t byteme::RawBufferReader::read ( unsigned char * buffer,
std::size_t n )
inlinevirtual

Read the specified number of bytes from the source into a user-supplied buffer.

Parameters
[out]bufferPointer to an array of at least length n.
nMaximum number of bytes to extract from the source. This may be zero.
Returns
Number of bytes that were actually extracted from the source. This will be less than or equal to n. If less than n, the stream of bytes from the source is finished and no more calls to read() should be performed.

Implements byteme::Reader.


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