size_t IStream::ReadAllLinesTo(List<HeapString>& outLines, size_t maxCount/*=1024*/, bool isTrim/*=true*/, bool ignoreEmptyLine/*=true*/)const { size_t count = 0; HeapString temp; temp.ReserveLength(maxCount); while (true) { temp.Clear(); size_t readCount = ReadLineToString(temp); count += readCount; BREAK_IF_ZERO(readCount); if (ignoreEmptyLine) { CONTINUE_IF_EMPTY(temp); } if (isTrim) { temp.TrimAll(); } outLines.Add(temp); temp.ForceSetLength(0); } return count; }
bool File::ReadAllTextTo(StringRef filePath, HeapString& outString) { FileStream reader(filePath, FileOpenMode::ReadOnly, FileDataType::Text); if (reader.IsOpen()) { outString.ReserveLength(reader.Length()); reader.ReadStringTo(outString); return true; } return false; }