ClassiCube/ClassicalSharp/Utils/ReadOnlyStream.cs
UnknownShadow200 98d435b110 fix licensing
2017-01-20 09:12:04 +11:00

29 lines
900 B
C#

// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
using System;
using System.IO;
namespace ClassicalSharp {
/// <summary> Implements a non-seekable stream that can only be read from. </summary>
internal abstract class ReadOnlyStream : Stream {
static NotSupportedException ex = new NotSupportedException("Writing/Seeking not supported");
public override bool CanRead { get { return true; } }
public override bool CanSeek { get { return false; } }
public override bool CanWrite { get { return false; } }
public override long Length { get { throw ex; } }
public override long Position { get { throw ex; } set { throw ex; } }
public override long Seek(long offset, SeekOrigin origin) { throw ex; }
public override void SetLength(long value) { throw ex; }
public override void Write(byte[] buffer, int offset, int count) { throw ex; }
}
}