A writer that writes data to an underlying output stream as binary data.
More...
#include <CeresEngine/Foundation/IO/Stream.hpp>
A writer that writes data to an underlying output stream as binary data.
◆ Seek
◆ BinaryWriter() [1/2]
| CeresEngine::BinaryWriter::BinaryWriter |
( |
OutputStream |
outputStream | ) |
|
|
inlineexplicit |
◆ BinaryWriter() [2/2]
| CeresEngine::BinaryWriter::BinaryWriter |
( |
IOutputStream & |
outputStream | ) |
|
|
inlineexplicit |
◆ getOutputStream() [1/2]
| OutputStream & CeresEngine::BinaryWriter::getOutputStream |
( |
| ) |
|
|
inline |
The output stream to which data will be written to.
◆ getOutputStream() [2/2]
The output stream to which data will be written to.
◆ isSeekable()
| bool CeresEngine::BinaryWriter::isSeekable |
( |
const Seek |
mode = Seek::Start | ) |
const |
|
inlinenoexcept |
Checks if the stream is seekable.
If this method returns true, seek() is safe to be called on this stream.
◆ isSizeKnown()
| bool CeresEngine::BinaryWriter::isSizeKnown |
( |
| ) |
const |
|
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.
◆ isTellable()
| bool CeresEngine::BinaryWriter::isTellable |
( |
| ) |
const |
|
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.
◆ seek()
| void CeresEngine::BinaryWriter::seek |
( |
const std::streamsize |
position, |
|
|
const Seek |
mode = Seek::Start |
|
) |
| |
|
inline |
Changes the position of the data stream.
- Note
- This method is only callable if
isSeekable() returns true.
- Parameters
-
| position | The position to set the data stream to. |
| mode | The mode to change the data stream position. |
◆ size()
| size_t CeresEngine::BinaryWriter::size |
( |
| ) |
|
|
inline |
Gets the number of bytes available on the stream.
- Note
- This method is only callable if
isSizeKnown() returns true.
◆ skip()
Skips n bytes from the data stream.
◆ tell()
| size_t CeresEngine::BinaryWriter::tell |
( |
| ) |
|
|
inline |
Gets the absolute stream position, in bytes.
- Note
- This method is only callable if
isTellable() returns true.
◆ tryWrite()
| bool CeresEngine::BinaryWriter::tryWrite |
( |
const T & |
value, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Tries to write a data type to the stream.
If the write fails, returns false.
◆ write() [1/2]
| void CeresEngine::BinaryWriter::write |
( |
const T & |
value, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Writes a binary representation of T to the stream.
- Note
- The actual encoding of the data is done by
BinaryCodec.
◆ write() [2/2]
Writes data to the data stream from a buffer of raw memory data with length n.
- Note
- This method is only callable if
isWritable() returns true.
- Parameters
-
| 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. |
- Returns
- The number of bytes actually written. Can be smaller than
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.
◆ mOutputStream
The output stream to which data will be written to.
The documentation for this class was generated from the following file:
- /Users/Rogiel/Developer/CeresEngine/Engine/Sources/CeresEngine/Foundation/IO/Stream.hpp