mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 16:05:27 +00:00
41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using System.IO;
|
|
using System.Linq;
|
|
using SharpCompress.Common;
|
|
using SharpCompress.Common.Tar;
|
|
|
|
namespace SharpCompress.Archive.Tar
|
|
{
|
|
public class TarArchiveEntry : TarEntry, IArchiveEntry
|
|
{
|
|
private TarArchive archive;
|
|
|
|
internal TarArchiveEntry(TarArchive archive, TarFilePart part, CompressionType compressionType)
|
|
: base(part, compressionType)
|
|
{
|
|
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
|
|
}
|
|
} |