|
Minecraft Community Edition 0.1.0
|
Platform-independent file output stream implementation. More...
#include <FileOutputStream.hpp>
Public Member Functions | |
| FileOutputStream ()=default | |
| Default constructor. | |
| bool | open (const std::string &file) |
| Opens a file for writing (creates/truncates by default). | |
| bool | isOpen () const |
| Query whether the underlying file handle is open. | |
| void | close () |
| Close the file and release any resources. | |
| size_t | write (const void *buffer, size_t size) override |
| Write bytes to the file. | |
| size_t | seek (size_t position) override |
| Change the current write position in the file. | |
| size_t | tell () override |
| Get the current write position in the file. | |
| size_t | getSize () override |
| Get the total size of the underlying file in bytes. | |
Static Public Attributes | |
| static constexpr size_t | INVALID_FILE_SIZE = ~(0) |
| Constant indicating an invalid file size/position. | |
| static constexpr size_t | INVALID_FILE_POSITION = ~(0) |
| Constant indicating an invalid file position. | |
Platform-independent file output stream implementation.
Provides a concrete OutputStream that writes data to a file using the platform native file handle or FILE* depending on the platform.
|
overridevirtual |
Get the total size of the underlying file in bytes.
Implements mce::io::stream::OutputStream.
| bool mce::io::stream::FileOutputStream::isOpen | ( | ) | const |
Query whether the underlying file handle is open.
| bool mce::io::stream::FileOutputStream::open | ( | const std::string & | file | ) |
Opens a file for writing (creates/truncates by default).
| file | Path (absolute or relative) to the file to open. |
|
overridevirtual |
Change the current write position in the file.
| position | The absolute position (in bytes) to seek to. |
Implements mce::io::stream::OutputStream.
|
overridevirtual |
Get the current write position in the file.
Implements mce::io::stream::OutputStream.
|
overridevirtual |
Write bytes to the file.
| buffer | Pointer to the data to write. |
| size | Number of bytes to write from buffer. |
Implements mce::io::stream::OutputStream.
|
inlinestaticconstexpr |