2013-04-07 10:58:58 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SharpCompress.IO
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class CountingWritableSubStream : Stream
|
|
|
|
|
|
{
|
|
|
|
|
|
private Stream writableStream;
|
|
|
|
|
|
|
|
|
|
|
|
internal CountingWritableSubStream(Stream stream)
|
|
|
|
|
|
{
|
|
|
|
|
|
writableStream = stream;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public uint Count { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
public override bool CanRead
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return false; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool CanSeek
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return false; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool CanWrite
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return true; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Flush()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override long Length
|
|
|
|
|
|
{
|
2015-03-14 12:46:34 +02:00
|
|
|
|
get { throw new NotSupportedException(); }
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override long Position
|
|
|
|
|
|
{
|
2015-03-14 12:46:34 +02:00
|
|
|
|
get { throw new NotSupportedException(); }
|
|
|
|
|
|
set { throw new NotSupportedException(); }
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int Read(byte[] buffer, int offset, int count)
|
|
|
|
|
|
{
|
2015-03-14 12:46:34 +02:00
|
|
|
|
throw new NotSupportedException();
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override long Seek(long offset, SeekOrigin origin)
|
|
|
|
|
|
{
|
2015-03-14 12:46:34 +02:00
|
|
|
|
throw new NotSupportedException();
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void SetLength(long value)
|
|
|
|
|
|
{
|
2015-03-14 12:46:34 +02:00
|
|
|
|
throw new NotSupportedException();
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Write(byte[] buffer, int offset, int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
writableStream.Write(buffer, offset, count);
|
2013-04-28 12:32:55 +01:00
|
|
|
|
Count += (uint) count;
|
2013-04-07 10:58:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-04-28 12:32:55 +01:00
|
|
|
|
}
|