ssize_t FKCW_IO_AssetInputStream_android::Read(char* buffer, size_t length) { int canRead = MIN(length, GetAvailableLength()); memcpy(buffer, m_buffer + m_position, canRead); m_position += canRead; return canRead; }
std::vector<unsigned char> InMemoryStream::GetBytes(unsigned int count) { ARC_ASSERT(count <= GetAvailableLength()); std::vector<unsigned char> result; result.resize(count); auto currentPos = m_data + m_bytesRead; std::copy(currentPos, currentPos + count, result.begin()); m_bytesRead += count; return result; }
void InMemoryStream::EnsureBytesAvailable(unsigned int count /* = 0 */) { ARC_ASSERT(count <= GetAvailableLength()); UNREFERENCED_PARAMETER(count); // needed for release builds // nothing to do here other than assert, There is no data source to pull extra bytes from }
void InMemoryStream::Advance(unsigned int count) { ARC_ASSERT(count <= GetAvailableLength()); m_bytesRead += count; }