mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 14:54:09 +02:00
make BufferedFileStream act like UnbufferedFileStream
This commit is contained in:
parent
32966b79a6
commit
e13f194c6f
1 changed files with 30 additions and 0 deletions
|
@ -296,6 +296,15 @@ namespace System.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int64 Position
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// Matches the behavior of Platform.BfpFile_Seek(mBfpFile, value, .Absolute);
|
||||||
|
mPos = Math.Max(value, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -416,6 +425,27 @@ namespace System.IO
|
||||||
mFileAccess = access;
|
mFileAccess = access;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Result<void> Seek(int64 pos, SeekKind seekKind = .Absolute)
|
||||||
|
{
|
||||||
|
int64 newPos;
|
||||||
|
switch (seekKind)
|
||||||
|
{
|
||||||
|
case .Absolute:
|
||||||
|
newPos = pos;
|
||||||
|
case .FromEnd:
|
||||||
|
newPos = Length + pos;
|
||||||
|
case .Relative:
|
||||||
|
newPos = mPos + pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Matches the behaviour of Platform.BfpFile_Seek(mBfpFile, value, .Absolute);
|
||||||
|
mPos = Math.Max(newPos, 0);
|
||||||
|
if (seekKind == .Absolute && newPos < 0)
|
||||||
|
return .Err;
|
||||||
|
|
||||||
|
return .Ok;
|
||||||
|
}
|
||||||
|
|
||||||
public override Result<void> Close()
|
public override Result<void> Close()
|
||||||
{
|
{
|
||||||
let ret = base.Close();
|
let ret = base.Close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue