mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 01:58:00 +02:00
Chunked string reading
This commit is contained in:
parent
8495edb5f0
commit
0cdfff4898
1 changed files with 9 additions and 8 deletions
|
@ -103,16 +103,17 @@ namespace System.IO
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return .Err;
|
return .Err;
|
||||||
|
|
||||||
for (int64 i = 0; i < size; i++)
|
int prevLen = output.Length;
|
||||||
|
char8* buf = output.PrepareBuffer(size);
|
||||||
|
switch (TryRead(.((uint8*)buf, size)))
|
||||||
{
|
{
|
||||||
Result<char8> char = Read<char8>();
|
case .Ok(let readLen):
|
||||||
if (char == .Err)
|
if (readLen < size)
|
||||||
return .Err;
|
output.Length = prevLen + readLen;
|
||||||
|
return .Ok;
|
||||||
output.Append(char);
|
case .Err:
|
||||||
|
return .Err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return .Ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<void> ReadStrSized32(String output)
|
public Result<void> ReadStrSized32(String output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue