* Add missing readUByte to stream

This commit is contained in:
Antidote 2014-02-12 18:55:38 -08:00
parent 2731ac3dff
commit 9c38e96403
2 changed files with 21 additions and 0 deletions

View File

@ -122,6 +122,14 @@ public:
* \throw IOException
*/
virtual Int8 readByte();
/*! \brief Reads a byte at the current position and advances the current position
*
* \return Uint8 The value at the current position
* \throw IOException
*/
virtual Uint8 readUByte();
/*! \brief Reads a byte at the current position and advances the current position.
*
* \return Uint8* The buffer at the current position from the given length.

View File

@ -198,6 +198,19 @@ Int8 Stream::readByte()
return *(Int8*)(m_data + m_position++);
}
Uint8 Stream::readUByte()
{
if (m_bitPosition > 0)
{
m_bitPosition = 0;
m_position += sizeof(Uint8);
}
if (m_position + 1 > m_length)
throw error::IOException("Stream::readUByte -> Position passed stream bounds");
return *(Uint8*)(m_data + m_position++);
}
Uint8 *Stream::readUBytes(Int64 length)
{
return (Uint8*)readBytes(length);