Reading from a StreamDecorator using a BufferedStream may throw an ArgumentOutOfRangeException:
using CompoundFile cf = new(CFSVersion.Ver_4, CFSConfiguration.Default);
CFStream cfStream = cf.RootStorage.AddStream("MyStream");
using Stream stream = cfStream.AsIOStream();
const int BufferLength = 4096 * 21;
var buffer = Helpers.GetBuffer(BufferLength);
stream.Write(buffer, 0, buffer.Length);
stream.Position = 0;
Assert.AreEqual(BufferLength, cfStream.Size);
using MemoryStream memoryStream = new();
using BufferedStream bufferedStream = new(stream);
bufferedStream.CopyTo(memoryStream);
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
List`1.get_Item(Int32 index)
StreamView.Read(Byte[] buffer, Int32 offset, Int32 count) line 119
CompoundFile.ReadData(IDirectoryEntry de, Int64 position, Byte[] buffer, Int32 offset, Int32 count) line 2239
CFStream.Read(Byte[] buffer, Int64 position, Int32 offset, Int32 count) line 201
StreamDecorator.Read(Byte[] buffer, Int32 offset, Int32 count) line 69
BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
Reactions are currently unavailable
Reading from a StreamDecorator using a BufferedStream may throw an ArgumentOutOfRangeException:
using CompoundFile cf = new(CFSVersion.Ver_4, CFSConfiguration.Default); CFStream cfStream = cf.RootStorage.AddStream("MyStream"); using Stream stream = cfStream.AsIOStream(); const int BufferLength = 4096 * 21; var buffer = Helpers.GetBuffer(BufferLength); stream.Write(buffer, 0, buffer.Length); stream.Position = 0; Assert.AreEqual(BufferLength, cfStream.Size); using MemoryStream memoryStream = new(); using BufferedStream bufferedStream = new(stream); bufferedStream.CopyTo(memoryStream);ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) List`1.get_Item(Int32 index) StreamView.Read(Byte[] buffer, Int32 offset, Int32 count) line 119 CompoundFile.ReadData(IDirectoryEntry de, Int64 position, Byte[] buffer, Int32 offset, Int32 count) line 2239 CFStream.Read(Byte[] buffer, Int64 position, Int32 offset, Int32 count) line 201 StreamDecorator.Read(Byte[] buffer, Int32 offset, Int32 count) line 69 BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)