1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-20 00:50:25 +02:00

Add Peek to StreamReader class

This commit is contained in:
disarray2077 2022-01-01 21:25:52 -03:00 committed by GitHub
parent e146475a39
commit 9ce0cc217a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -182,6 +182,17 @@ namespace System.IO
return .Ok; return .Ok;
} }
public Result<char8> Peek()
{
if (mStream == null)
return .Err;
if (mCharPos == mCharLen)
{
if (Try!(ReadBuffer()) == 0) return .Err;
}
return mCharBuffer[mCharPos + 1];
}
public Task<String> ReadLineAsync() public Task<String> ReadLineAsync()
{ {
// If we have been inherited into a subclass, the following implementation could be incorrect // If we have been inherited into a subclass, the following implementation could be incorrect