diff --git a/BeefLibs/corlib/src/IO/MemoryStream.bf b/BeefLibs/corlib/src/IO/MemoryStream.bf index 1522dad0..ac994cc6 100644 --- a/BeefLibs/corlib/src/IO/MemoryStream.bf +++ b/BeefLibs/corlib/src/IO/MemoryStream.bf @@ -50,6 +50,12 @@ namespace System.IO mOwns = true; mMemory = new List(); } + + public this(int capacity) + { + mOwns = true; + mMemory = new List(capacity); + } public this(List memory, bool owns = true) { @@ -90,5 +96,17 @@ namespace System.IO { return .Ok; } + + public override Result SetLength(int64 length) + { + Debug.Assert(mOwns); + + mMemory.Resize((.)length); + + if (Position >= length) + Position = Length; + + return .Ok; + } } }