A reader that parses data from an underlying input stream as binary data.
More...
#include <CeresEngine/Foundation/IO/Stream.hpp>
A reader that parses data from an underlying input stream as binary data.
◆ Seek
◆ BinaryReader() [1/2]
| CeresEngine::BinaryReader::BinaryReader |
( |
InputStream |
inputStream | ) |
|
|
inlineexplicit |
◆ BinaryReader() [2/2]
| CeresEngine::BinaryReader::BinaryReader |
( |
IInputStream & |
inputStream | ) |
|
|
inlineexplicit |
◆ getInputStream() [1/2]
| InputStream & CeresEngine::BinaryReader::getInputStream |
( |
| ) |
|
|
inline |
The input stream to which data will be read from.
◆ getInputStream() [2/2]
The input stream to which data will be read from.
◆ isSeekable()
| bool CeresEngine::BinaryReader::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::BinaryReader::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::BinaryReader::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.
◆ read() [1/2]
| T CeresEngine::BinaryReader::read |
( |
Args &&... |
args | ) |
|
|
inline |
Reads a binary representation of T from the stream.
- Note
- The actual decoding of the data is done by
BinaryCodec.
◆ read() [2/2]
Reads data from the data stream to a buffer of raw memory data with length n.
- Note
- This method is only callable if
isReadable() returns true.
- Parameters
-
| data | The memory location to which read data should be placed. |
| n | The maximum number of bytes to be read from the data stream. |
- Returns
- The number of bytes actually read. Can be smaller than
n. If 0, indicates that the stream has ended.
◆ seek()
| void CeresEngine::BinaryReader::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::BinaryReader::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::BinaryReader::tell |
( |
| ) |
|
|
inline |
Gets the absolute stream position, in bytes.
- Note
- This method is only callable if
isTellable() returns true.
◆ tryRead()
| Optional< T > CeresEngine::BinaryReader::tryRead |
( |
Args &&... |
args | ) |
|
|
inline |
Tries to read a data type from the stream.
If the read fails, returns an empty optional.
◆ mInputStream
The input stream to which data will be read from.
The documentation for this class was generated from the following file:
- /Users/Rogiel/Developer/CeresEngine/Engine/Sources/CeresEngine/Foundation/IO/Stream.hpp