|
CeresEngine 0.2.0
A game development framework
|
A reader that parses data from an underlying input stream as binary data. More...
#include <CeresEngine/Foundation/IO/Stream.hpp>
Public Types | |
| using | Seek = Stream::Seek |
Public Member Functions | |
| AsyncBinaryReader (AsyncInputStream inputStream) | |
| AsyncBinaryReader (IAsyncInputStream &inputStream) | |
| template<typename T , typename... Args> | |
| Async< T > | read (Args &&... args) |
Reads a binary representation of T from the stream. | |
| template<typename T , typename... Args> | |
| Async< Optional< T > > | tryRead (Args &&... args) |
| Tries to read a data type from the stream. | |
| Async< size_t > | read (void *data, const size_t n) |
Reads data from the data stream to 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. | |
| AsyncInputStream & | getInputStream () |
| The input stream to which data will be read from. | |
| const AsyncInputStream & | getInputStream () const |
| The input stream to which data will be read from. | |
Private Attributes | |
| AsyncInputStream | mInputStream |
| The input stream to which data will be read from. | |
A reader that parses data from an underlying input stream as binary data.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
The input stream to which data will be read from.
|
inline |
The input stream to which data will be read from.
|
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.
Reads a binary representation of T from the stream.
BinaryCodec. Reads data from the data stream to a buffer of raw memory data with length n.
isReadable() returns true.| data | The memory location to which read data should be placed. |
| n | The maximum number of bytes to be read from the data stream. |
n. If 0, indicates that the stream has ended.
|
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 read a data type from the stream.
If the read fails, returns an empty optional.
|
private |
The input stream to which data will be read from.