Replaced NotImplementedException for streams

Especially for streams, it is more appropriate to throw
NotSupportedException instead of NotImplementedException. Usually
consumers of streams expect NotSupportedException to handle errors.
There are other places that also use NotImplementedException but I
didn't examine them for now. I only modified stream classes in
SharpCompress.IO. For reference about this best practise, please see
these articles:
http://blogs.msdn.com/b/brada/archive/2004/07/29/201354.aspx

http://blogs.msdn.com/b/jaredpar/archive/2008/12/12/notimplementedexception-vs-notsupportedexception.aspx
This commit is contained in:
catester
2015-03-14 12:46:34 +02:00
parent a8c055b990
commit 391663ac67
4 changed files with 24 additions and 24 deletions

View File

@@ -48,18 +48,18 @@ namespace SharpCompress.IO
public override void Flush()
{
throw new System.NotImplementedException();
throw new System.NotSupportedException();
}
public override long Length
{
get { throw new System.NotImplementedException(); }
get { throw new System.NotSupportedException(); }
}
public override long Position
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
get { throw new System.NotSupportedException(); }
set { throw new System.NotSupportedException(); }
}
public override int Read(byte[] buffer, int offset, int count)
@@ -78,17 +78,17 @@ namespace SharpCompress.IO
public override long Seek(long offset, SeekOrigin origin)
{
throw new System.NotImplementedException();
throw new System.NotSupportedException();
}
public override void SetLength(long value)
{
throw new System.NotImplementedException();
throw new System.NotSupportedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
throw new System.NotImplementedException();
throw new System.NotSupportedException();
}
}
}