|
CeresEngine 0.2.0
A game development framework
|
A writer that writes data to an underlying output stream as binary data. More...
#include <CeresEngine/Foundation/IO/Stream.hpp>
Public Types | |
| using | Seek = Stream::Seek |
Public Member Functions | |
| AsyncBinaryWriter (AsyncOutputStream outputStream) | |
| AsyncBinaryWriter (IAsyncOutputStream &outputStream) | |
| template<typename T , typename... Args> | |
| Async | write (const T &value, Args &&... args) |
Writes a binary representation of T to the stream. | |
| template<typename T , typename... Args> | |
| Async< bool > | tryWrite (const T &value, Args &&... args) |
| Tries to write a data type to the stream. | |
| Async< size_t > | write (const void *data, const size_t n) |
Writes data to the data stream from a buffer of raw memory data with length n. | |
| bool | isSeekable (const Seek mode=Seek::Start) const noexcept |
| Checks if the stream is seekable. | |
| Async | seek (const std::streamsize position, const Seek mode=Seek::Start) |
| Changes the position of the data stream. | |
| Async | skip (const size_t n) |
Skips n bytes from the data stream. | |
| bool | isTellable () const noexcept |
| Checks if the stream knows it's current absolute position. | |
| Async< size_t > | tell () |
| Gets the absolute stream position, in bytes. | |
| bool | isSizeKnown () const noexcept |
| Checks if the stream knows the size of the data. | |
| Async< size_t > | size () |
| Gets the number of bytes available on the stream. | |
| AsyncOutputStream & | getOutputStream () |
| The output stream to which data will be written to. | |
| const AsyncOutputStream & | getOutputStream () const |
| The output stream to which data will be written to. | |
Private Attributes | |
| AsyncOutputStream | mOutputStream |
| The output stream to which data will be written to. | |
A writer that writes data to an underlying output stream as binary data.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
The output stream to which data will be written to.
|
inline |
The output stream to which data will be written to.
|
inlinenoexcept |
Checks if the stream is seekable.
If this method returns true, seek() is safe to be called on this stream.
|
inlinenoexcept |
Checks if the stream knows the size of the data.
If this method returns true, size() is safe to be called on this stream.
|
inlinenoexcept |
Checks if the stream knows it's current absolute position.
If this method returns true, tell() is safe to be called on this stream.
|
inline |
Changes the position of the data stream.
isSeekable() returns true.| position | The position to set the data stream to. |
| mode | The mode to change the data stream position. |
Gets the number of bytes available on the stream.
isSizeKnown() returns true. Skips n bytes from the data stream.
Gets the absolute stream position, in bytes.
isTellable() returns true. Tries to write a data type to the stream.
If the write fails, returns false.
Writes a binary representation of T to the stream.
BinaryCodec. Writes data to the data stream from a buffer of raw memory data with length n.
isWritable() returns true.| data | The memory location to which written data should be copied from. |
| n | The maximum number of bytes to be write to the data stream. |
n, in that case the write operation must be repeated to ensure that all data was written. If 0, indicates that the stream has ended.
|
private |
The output stream to which data will be written to.