Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Core class that represents a stream of bytes. More...
Public Member Functions | |
ByteStream (Stream *stream=nullptr) | |
Constructs a ByteStream object with a stream. | |
ByteStream (ByteArray *byteArray, OpenModeFlags openMode=OpenMode_ReadWrite) | |
Constructs a ByteStream object with a byte array. More... | |
ByteStream (void *ptr, Nz::UInt64 size) | |
Constructs a ByteStream object with a raw memory and a size. More... | |
ByteStream (const void *ptr, Nz::UInt64 size) | |
Constructs a ByteStream object with a raw memory and a size. More... | |
ByteStream (const ByteStream &)=delete | |
ByteStream (ByteStream &&stream) | |
Constructs a ByteStream object by move semantic. More... | |
virtual | ~ByteStream () |
Destructs the object and calls FlushBits. More... | |
Endianness | GetDataEndianness () const |
Gets the stream endianness. More... | |
Nz::UInt64 | GetSize () const |
Gets the size of the byte stream. More... | |
Stream * | GetStream () const |
Gets the internal stream. More... | |
bool | FlushBits () |
Flushes the stream. More... | |
std::size_t | Read (void *ptr, std::size_t size) |
Reads data. More... | |
void | SetDataEndianness (Endianness endiannes) |
Sets the stream endianness. More... | |
void | SetStream (Stream *stream) |
Sets this with a stream. More... | |
void | SetStream (ByteArray *byteArray, OpenModeFlags openMode=OpenMode_ReadWrite) |
Sets this with a byte array. More... | |
void | SetStream (void *ptr, Nz::UInt64 size) |
Sets this with a raw memory and a size. More... | |
void | SetStream (const void *ptr, Nz::UInt64 size) |
Sets this with a raw memory and a size. More... | |
void | Write (const void *data, std::size_t size) |
Writes data. More... | |
template<typename T > | |
ByteStream & | operator>> (T &value) |
Outputs a data from the stream. More... | |
template<typename T > | |
ByteStream & | operator<< (const T &value) |
Adds the data to the stream. More... | |
ByteStream & | operator= (const ByteStream &)=delete |
ByteStream & | operator= (ByteStream &&) |
Moves the other byte stream into this. More... | |
Core class that represents a stream of bytes.
Nz::ByteStream::ByteStream | ( | ByteArray * | byteArray, |
OpenModeFlags | openMode = OpenMode_ReadWrite |
||
) |
Constructs a ByteStream object with a byte array.
byteArray | Bytes to stream |
openMode | Reading/writing mode for the stream |
Nz::ByteStream::ByteStream | ( | void * | ptr, |
Nz::UInt64 | size | ||
) |
Constructs a ByteStream object with a raw memory and a size.
ptr | Pointer to raw memory |
size | Size that can be read |
Nz::ByteStream::ByteStream | ( | const void * | ptr, |
Nz::UInt64 | size | ||
) |
Constructs a ByteStream object with a raw memory and a size.
ptr | Constant pointer to raw memory |
size | Size that can be read |
|
inline |
Constructs a ByteStream object by move semantic.
stream | ByteStream to move into this |
|
inlinevirtual |
Destructs the object and calls FlushBits.
|
inline |
Flushes the stream.
|
inline |
Gets the stream endianness.
|
inline |
Gets the size of the byte stream.
|
inline |
Gets the internal stream.
ByteStream & Nz::ByteStream::operator<< | ( | const T & | value | ) |
Adds the data to the stream.
value | Value to serialize |
|
inline |
Moves the other byte stream into this.
stream | ByteStream to move in this |
ByteStream & Nz::ByteStream::operator>> | ( | T & | value | ) |
Outputs a data from the stream.
value | Value to unserialize |
|
inline |
Reads data.
buffer | Preallocated buffer to contain information read |
size | Size of the read and thus of the buffer |
|
inline |
Sets the stream endianness.
Type | of the endianness |
|
inline |
Sets this with a stream.
stream | Stream existing |
void Nz::ByteStream::SetStream | ( | ByteArray * | byteArray, |
OpenModeFlags | openMode = OpenMode_ReadWrite |
||
) |
Sets this with a byte array.
byteArray | Bytes to stream |
openMode | Reading/writing mode for the stream |
void Nz::ByteStream::SetStream | ( | void * | ptr, |
Nz::UInt64 | size | ||
) |
Sets this with a raw memory and a size.
ptr | Pointer to raw memory |
size | Size that can be read |
void Nz::ByteStream::SetStream | ( | const void * | ptr, |
Nz::UInt64 | size | ||
) |
Sets this with a raw memory and a size.
ptr | Constant pointer to raw memory |
size | Size that can be read |
|
inline |
Writes data.
buffer | Preallocated buffer containing information to write |
size | Size of the writting and thus of the buffer |