Switchboard SDK
Loading...
Searching...
No Matches
switchboard::FileReader Class Reference

Reads a file from the file system. More...

#include <FileReader.hpp>

Static Public Member Functions

static const bool isReadable (const std::string &filePath)
 Checks if file exists and is readable.
 
static const uint64 read (const std::string &filePath, uint8 **buffer)
 Reads contents of file into byte buffer. Caller takes ownership of the resulting char buffer.
 
static const std::vector< uint8 > read (const std::string &filePath)
 Reads contents of file into byte vector.
 

Detailed Description

Reads a file from the file system.

FileReader class.

Member Function Documentation

◆ isReadable()

const bool switchboard::FileReader::isReadable ( const std::string & filePath)
static

Checks if file exists and is readable.

Parameters
filePathPath of the file to read.
Returns
True if file exists and readable, false otherwise.

◆ read() [1/2]

const std::vector< uint8 > switchboard::FileReader::read ( const std::string & filePath)
static

Reads contents of file into byte vector.

Parameters
filePathPath of the file to be read.
Returns
Byte vector of the read data.

◆ read() [2/2]

const uint64 switchboard::FileReader::read ( const std::string & filePath,
uint8 ** buffer )
static

Reads contents of file into byte buffer. Caller takes ownership of the resulting char buffer.

Parameters
filePathPath of the file to be read in the file system.
buffer[inout] Pointer where the data buffer will be allocated.
Returns
Number of bytes read.