nsInputFileStream inputStream(fileSpec); PRInt32 howMany = inputStream.read(contents, contentsLen); if (PRUint32(howMany) == contentsLen) { contents[contentsLen] = '\0'; sourceContents.AssignWithConversion(contents, contentsLen); rv = NS_OK; } delete [] contents; contents = nsnull;
stream.readline(buffer, sizeof(buffer)-1 ); sourceContents += buffer; sourceContents += "\n";
InternetSearchDataSource::ReadFileContents(const nsFileSpec &fileSpec, nsString& sourceContents){	nsresult			rv = NS_ERROR_FAILURE;	PRUint32			contentsLen;	char				*contents;	sourceContents.Truncate();	contentsLen = fileSpec.GetFileSize();	if (contentsLen > 0)	{		contents = new char [contentsLen + 1];		if (contents)		{			nsInputFileStream inputStream(fileSpec);	// defaults to read only		       	PRInt32 howMany = inputStream.read(contents, contentsLen);		        if (PRUint32(howMany) == contentsLen)		        {				contents[contentsLen] = '\0';				sourceContents.AssignWithConversion(contents, contentsLen);				rv = NS_OK;		        }	        	delete [] contents;	        	contents = nsnull;		}	}	return(rv);}