mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-14 13:35:38 +00:00
Delete `NonSeekableStream` used in Zip64 tests in favor of `ForwardOnlyStream` used in Mocks. Additionally, delete the `ForwardOnlyStream.ReadByte` implementation as the implementation on the base Stream is sufficient.
68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace SharpCompress.Test.Mocks
|
|
{
|
|
public class ForwardOnlyStream : Stream
|
|
{
|
|
private readonly Stream stream;
|
|
|
|
public bool IsDisposed { get; private set; }
|
|
|
|
public ForwardOnlyStream(Stream stream)
|
|
{
|
|
this.stream = stream;
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (!IsDisposed)
|
|
{
|
|
if (disposing)
|
|
{
|
|
stream.Dispose();
|
|
IsDisposed = true;
|
|
base.Dispose(disposing);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool CanRead => true;
|
|
|
|
public override bool CanSeek => false;
|
|
public override bool CanWrite => false;
|
|
|
|
public override void Flush()
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override long Length => throw new NotSupportedException();
|
|
|
|
public override long Position
|
|
{
|
|
get => throw new NotSupportedException();
|
|
set => throw new NotSupportedException();
|
|
}
|
|
|
|
public override int Read(byte[] buffer, int offset, int count)
|
|
{
|
|
return stream.Read(buffer, offset, count);
|
|
}
|
|
|
|
public override long Seek(long offset, SeekOrigin origin)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override void SetLength(long value)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override void Write(byte[] buffer, int offset, int count)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
} |