Files
duplicati/Duplicati/Library/Compression/StreamWrapper.cs
T
kenneth@hexad.dk a0521da54d Initial version of the new block-based storage format.
Still needs a work over in terms of error handling, progress reporting, warning output, refactoring etc.
Also misses the volume reuse/reclaim algorithms.
But it passes the unit tests now, with and without a local database.

git-svn-id: https://duplicati.googlecode.com/svn/sandboxes/Kenneth/ForestHash@1526 59da171f-624f-0410-aa54-27559c288bec
2013-02-12 21:43:14 +00:00

36 lines
915 B
C#

using System.IO;
namespace Duplicati.Library.Compression
{
/// <summary>
/// CompressionStream wrapper to prevent closing the base stream when disposing the entry stream
/// </summary>
public class StreamWrapper : Utility.OverrideableStream
{
public delegate void DisposingHandler(StreamWrapper sender);
public event DisposingHandler Disposing;
public StreamWrapper(Stream stream)
: base(stream)
{
}
protected override void Dispose(bool disposing)
{
if (!disposing || m_basestream == null) return;
if (Disposing != null)
Disposing(this);
m_basestream.Dispose();
m_basestream = null;
}
public long GetSize()
{
return m_basestream == null ? 0 : m_basestream.Length;
}
}
}