Represents the byte stream reader with custom byte order.
More...
#include <ReadStream.hpp>
Represents the byte stream reader with custom byte order.
◆ ReadStream() [1/2]
Constructor.
- Parameters
-
data | the source binary data. |
byteOrder | the byte order of the stream. If the byte order is ByteOrder::Unknown the platform byte order will be used. |
- Exceptions
-
◆ ReadStream() [2/2]
Constructor.
- Parameters
-
data | the source binary data. |
byteOrder | the byte order of the stream. If the byte order is ByteOrder::Unknown the platform byte order will be used. |
- Exceptions
-
◆ canRead() [1/2]
bool CppMate::ReadStream::canRead |
( |
uint64_t |
bytes | ) |
const |
|
inline |
Checks the ability to read a specified number of bytes.
- Parameters
-
bytes | the number of bytes to check. |
- Returns
true
if bytes might be read; false
otherwise.
◆ canRead() [2/2]
template<typename T >
bool CppMate::ReadStream::canRead |
( |
uint64_t |
count = 1 | ) |
const |
|
inline |
Checks the ability to read a specified number of items.
- Parameters
-
count | the number of items to check. |
- Returns
true
if items might be read; false
otherwise.
◆ getAvailable()
uint64_t CppMate::ReadStream::getAvailable |
( |
| ) |
const |
|
inline |
Returns number of bytes available to read.
- Returns
- number of bytes available to read.
◆ getByteOrder()
ByteOrder CppMate::ReadStream::getByteOrder |
( |
| ) |
const |
|
inline |
Returns byte order of the stream.
- Returns
- byte order of the stream.
◆ getData()
const BinaryData* CppMate::ReadStream::getData |
( |
| ) |
const |
|
inline |
Returns binary data of stream.
- Returns
- binary data of stream.
◆ getPosition()
uint64_t CppMate::ReadStream::getPosition |
( |
| ) |
const |
|
inline |
Returns current position of the stream.
- Returns
- current position of the stream.
◆ getSize()
uint64_t CppMate::ReadStream::getSize |
( |
| ) |
const |
|
inline |
Returns size of the stream.
- Returns
- size of the stream.
◆ operator!=()
bool CppMate::ReadStream::operator!= |
( |
const ReadStream & |
other | ) |
const |
|
inline |
operator !=
- Parameters
-
other | the instance to compare. |
- Returns
false
if instances is equal; true
otherwise.
◆ operator==()
bool CppMate::ReadStream::operator== |
( |
const ReadStream & |
other | ) |
const |
|
inline |
operator ==
- Parameters
-
other | the instance to compare. |
- Returns
true
if instances is equal; false
otherwise.
◆ read() [1/3]
template<typename T >
T CppMate::ReadStream::read |
( |
| ) |
|
|
inline |
Reads item from the stream. The method doesn't validate bounds, see canRead.
- Returns
- item from the stream.
◆ read() [2/3]
template<>
uint8_t CppMate::ReadStream::read |
( |
| ) |
|
|
inline |
◆ read() [3/3]
template<>
char CppMate::ReadStream::read |
( |
| ) |
|
|
inline |
◆ readBytes()
uint64_t CppMate::ReadStream::readBytes |
( |
uint8_t * |
buffer, |
|
|
uint64_t |
bufferSize |
|
) |
| |
|
inline |
Reads a particular number of bytes from the stream.
- Parameters
-
buffer | buffer to receive bytes. |
bufferSize | size of the buffer. |
- Returns
- number of bytes read.
- Exceptions
-
◆ readString()
std::string CppMate::ReadStream::readString |
( |
uint64_t |
length | ) |
|
|
inline |
Reads string from the stream.
- Parameters
-
length | the length of the string to read. |
- Returns
- string read from stream.
◆ reset()
void CppMate::ReadStream::reset |
( |
| ) |
|
|
inline |
Resets stream position to begin of the source data.
◆ seek() [1/2]
template<typename T >
void CppMate::ReadStream::seek |
( |
uint64_t |
count = 1 | ) |
|
|
inline |
Seeks stream over a specified number of items.
- Parameters
-
count | the number of items. |
◆ seek() [2/2]
void CppMate::ReadStream::seek |
( |
uint64_t |
offset, |
|
|
bool |
forward = true |
|
) |
| |
|
inline |
Changes position of the stream by increase the offset value with the current position. The offset can be negative to move the current position back.
- Parameters
-
offset | the offset from the current position of the stream. |
forward | indicates that offset should be calculated forward; otherwise backward. |
◆ seekAlign()
void CppMate::ReadStream::seekAlign |
( |
unsigned |
align | ) |
|
|
inline |
Changes position of stream to the closest position divisible by the provided parameter.
- Parameters
-
align | the align to calculate. |
◆ setPosition()
void CppMate::ReadStream::setPosition |
( |
uint64_t |
position | ) |
|
|
inline |
Sets a new absolute position of the stream.
- Parameters
-
◆ transfer()
void CppMate::ReadStream::transfer |
( |
BinarySink & |
sink, |
|
|
uint64_t |
bytes |
|
) |
| |
|
inline |
Transfer arbitrary block of bytes from stream to binary sink.
- Parameters
-
sink | the sink to transfer. |
bytes | the number of bytes to transfer. |
◆ operator>>
operator >>
- Parameters
-
stream | the read stream. |
result | the result of read. |
- Returns
- this
The documentation for this class was generated from the following file: