mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 16:05:27 +00:00
41 lines
1009 B
C#
41 lines
1009 B
C#
using System.IO;
|
|
using System.Linq;
|
|
using SharpCompress.Common;
|
|
using SharpCompress.Common.GZip;
|
|
|
|
namespace SharpCompress.Archive.GZip
|
|
{
|
|
public class GZipArchiveEntry : GZipEntry, IArchiveEntry
|
|
{
|
|
private GZipArchive archive;
|
|
|
|
internal GZipArchiveEntry(GZipArchive archive, GZipFilePart part)
|
|
: base(part)
|
|
{
|
|
this.archive = archive;
|
|
}
|
|
|
|
public virtual Stream OpenEntryStream()
|
|
{
|
|
return Parts.Single().GetCompressedStream();
|
|
}
|
|
|
|
#region IArchiveEntry Members
|
|
|
|
public void WriteTo(Stream streamToWriteTo)
|
|
{
|
|
if (IsEncrypted)
|
|
{
|
|
throw new PasswordProtectedException("Entry is password protected and cannot be extracted.");
|
|
}
|
|
this.Extract(archive, streamToWriteTo);
|
|
}
|
|
|
|
public bool IsComplete
|
|
{
|
|
get { return true; }
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |