GZipReader.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using SharpCompress.Common;
  4. using SharpCompress.Common.GZip;
  5. namespace SharpCompress.Readers.GZip
  6. {
  7. public class GZipReader : AbstractReader<GZipEntry, GZipVolume>
  8. {
  9. internal GZipReader(Stream stream, ReaderOptions options)
  10. : base(options, ArchiveType.GZip)
  11. {
  12. Volume = new GZipVolume(stream, options);
  13. }
  14. public override GZipVolume Volume { get; }
  15. #region Open
  16. /// <summary>
  17. /// Opens a GZipReader for Non-seeking usage with a single volume
  18. /// </summary>
  19. /// <param name="stream"></param>
  20. /// <param name="options"></param>
  21. /// <returns></returns>
  22. public static GZipReader Open(Stream stream, ReaderOptions options = null)
  23. {
  24. stream.CheckNotNull("stream");
  25. return new GZipReader(stream, options ?? new ReaderOptions());
  26. }
  27. #endregion Open
  28. protected override IEnumerable<GZipEntry> GetEntries(Stream stream)
  29. {
  30. return GZipEntry.GetEntries(stream, Options);
  31. }
  32. }
  33. }