127 * \brief Reads in characters until a null terminator is encountered. |
127 * \brief Reads in characters until a null terminator is encountered. |
128 * \returns the read string. |
128 * \returns the read string. |
129 */ |
129 */ |
130 String Bytestream::readString() |
130 String Bytestream::readString() |
131 { |
131 { |
132 Vector<unsigned char>::Iterator stringEndIterator; |
132 ByteArray::Iterator stringEndIterator; |
133 |
133 |
134 // Where's the end of the string? |
134 // Where's the end of the string? |
135 for (stringEndIterator = getCurrentIterator(); *stringEndIterator != '\0'; ++stringEndIterator) |
135 for (stringEndIterator = getCurrentIterator(); *stringEndIterator != '\0'; ++stringEndIterator) |
136 { |
136 { |
137 if (stringEndIterator == m_data.end()) |
137 if (stringEndIterator == m_data.end()) |
156 /*! |
156 /*! |
157 * \brief Reads in a buffer of the specified length. |
157 * \brief Reads in a buffer of the specified length. |
158 * \param length Amount of bytes to read. |
158 * \param length Amount of bytes to read. |
159 * \returns the read buffer. |
159 * \returns the read buffer. |
160 */ |
160 */ |
161 Vector<unsigned char> Bytestream::readBuffer(int length) |
161 ByteArray Bytestream::readBuffer(int length) |
162 { |
162 { |
163 ensureReadSpace(length); |
163 ensureReadSpace(length); |
164 Vector<unsigned char> result(length); |
164 ByteArray result(length); |
165 memcpy(result.data(), m_data.data() + m_position, length); |
165 memcpy(result.data(), m_data.data() + m_position, length); |
166 m_position += length; |
166 m_position += length; |
167 return result; |
167 return result; |
168 } |
168 } |
169 |
169 |