Implementation of input stream based on a file. More...
#include <SFML/System/FileInputStream.hpp>
Public Member Functions | |
FileInputStream () | |
Default constructor. | |
virtual | ~FileInputStream () |
Default destructor. | |
bool | open (const std::string &filename) |
Open the stream from a file path. | |
virtual Int64 | read (void *data, Int64 size) |
Read data from the stream. | |
virtual Int64 | seek (Int64 position) |
Change the current reading position. | |
virtual Int64 | tell () |
Get the current reading position in the stream. | |
virtual Int64 | getSize () |
Return the size of the stream. | |
Implementation of input stream based on a file.
This class is a specialization of InputStream that reads from a file on disk.
It wraps a file in the common InputStream interface and therefore allows to use generic classes or functions that accept such a stream, with a file on disk as the data source.
In addition to the virtual functions inherited from InputStream, FileInputStream adds a function to specify the file to open.
SFML resource classes can usually be loaded directly from a filename, so this class shouldn't be useful to you unless you create your own algorithms that operate on an InputStream.
Usage example:
InputStream, MemoryInputStream
Definition at line 55 of file FileInputStream.hpp.
sf::FileInputStream::FileInputStream | ( | ) |
Default constructor.
|
virtual |
Default destructor.
|
virtual |
Return the size of the stream.
Implements sf::InputStream.
bool sf::FileInputStream::open | ( | const std::string & | filename | ) |
Open the stream from a file path.
filename | Name of the file to open |
|
virtual |
Read data from the stream.
After reading, the stream's reading position must be advanced by the amount of bytes read.
data | Buffer where to copy the read data |
size | Desired number of bytes to read |
Implements sf::InputStream.
|
virtual |
Change the current reading position.
position | The position to seek to, from the beginning |
Implements sf::InputStream.
|
virtual |
Get the current reading position in the stream.
Implements sf::InputStream.