mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-22 17:48:01 +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)
|
||||
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>();
|
||||
if (char == .Err)
|
||||
return .Err;
|
||||
|
||||
output.Append(char);
|
||||
case .Ok(let readLen):
|
||||
if (readLen < size)
|
||||
output.Length = prevLen + readLen;
|
||||
return .Ok;
|
||||
case .Err:
|
||||
return .Err;
|
||||
}
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
public Result<void> ReadStrSized32(String output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue