Ejemplo n.º 1
0
	void DataOutput::WriteByteArray(ByteArray& buffer,
									uint32_t offset,
									uint32_t count)
	{
		if (buffer.GetLength() < offset)
			offset = buffer.GetLength();

		if (count == 0) {
			count = buffer.GetLength()-offset;
		}

		if (count > buffer.GetLength()-offset) {
			ThrowRangeError();
		}
			
		if (count > 0) {
			Write(buffer.GetBuffer()+offset, count);
		}
	}
Ejemplo n.º 2
0
	void DataInput::ReadByteArray(ByteArray& buffer,
								  uint32_t offset,
								  uint32_t count)
	{
		uint32_t available = Available();
		
		if (count == 0) {
			count = available;
		}
		
		if (count > available) {
			ThrowEOFError();
		}

		// Grow the buffer if necessary
		if (offset + count >= buffer.GetLength()) {
			buffer.SetLength(offset + count);
		}

		Read(buffer.GetBuffer() + offset, count);
	}