示例#1
0
文件: pldatasrc.cpp 项目: artcom/y60
void PLDataSource::Seek
    ( int n
    )
{
  m_BytesRead = n;
  CheckEOF();
}
示例#2
0
文件: DataIO.cpp 项目: Jeffxz/nodeas
	String* DataInput::ReadUTFBytes(uint32_t length)
	{
		CheckEOF(length);
		
		char *buffer = mmfx_new_array_opt( char, length+1, MMgc::kCanFail );
		if (!buffer) {
			ThrowMemoryError();
		}

		Read(buffer, length);
		buffer[length] = 0;
		
		// Since this is supposed to read UTF8 into a string, it really should ignore the UTF8 BOM that
		// might reasonably occur at the head of the data.
		char* utf8chars = buffer;
		if (length >= 3 && (unsigned char)buffer[0] == 0xEF && (unsigned char)buffer[1] == 0xBB && (unsigned char)buffer[2] == 0xBF) 
		{
			utf8chars += 3;
		}

		String *out = m_toplevel->core()->newStringUTF8(utf8chars);
		mmfx_delete_array( buffer );
		
		return out;
	}
示例#3
0
	void ByteArrayFile::Read(void *buffer, uint32_t count)
	{
		CheckEOF(count);

		if (count > 0)
		{
			VMPI_memcpy(buffer, m_array+m_filePointer, count);
			m_filePointer += count;
		}
	}
示例#4
0
文件: pldatasrc.cpp 项目: artcom/y60
PLBYTE * PLDataSource::ReadNBytes
    ( int n
    )
{
  int OldBytesRead = m_BytesRead;
  m_BytesRead += n;
  if (m_BytesRead/1024 > OldBytesRead/1024 && m_pNotification)
    m_pNotification->OnProgress (double(m_BytesRead)/m_FileSize);
  CheckEOF();
  return NULL;
}
示例#5
0
void SocketFile::ReadOutCache(void *data, uint32_t length)
{
	CheckEOF(length);

	if (length > 0)
	{
		VMPI_memcpy(data, m_outCache.GetBuffer() + m_outReadPos, length);
		m_outReadPos += length;
	}

	//if (0 == OutCacheBytesAvailable())
	//{
	//	m_outReadPos = m_outWritePos = 0;
	//}
}
示例#6
0
void SocketFile::ReadInCache(void *data, uint32_t count)
{
	CheckEOF(count);

	if (count > 0)
	{
		AvmAssert(m_inReadPos+count<=m_inCache.GetLength());
		VMPI_memcpy(data, m_inCache.GetBuffer() + m_inReadPos, count);
		m_inReadPos += count;
	}

	//if (0 == InCacheBytesAvailable())
	//{
	//	m_inReadPos = m_inWritePos = 0;
	//}
}