3 using System
.Collections
;
7 using ICSharpCode
.SharpZipLib
;
8 using ICSharpCode
.SharpZipLib
.GZip
;
15 public class GzipFileObject
: FileObject
{
17 public GzipFileObject (FileObject gzipped_file
)
20 AddChild (gzipped_file
, null);
23 override protected string GetChildUri (FileSystemObject children
)
25 // FIXME: What is the uri scheme for gzip files?
26 return this.Uri
+ "#" + children
.Name
;
29 override public string MimeType
{
30 get { return "application/x-gzip"; }
33 override public string Extension
{
37 override public void AddToStream (Stream stream
, EventTracker tracker
)
40 throw new Exception ("Gzip file " + Uri
+ " has " + ChildCount
+ " children");
43 tracker
.ExpectingAdded (this.Uri
);
45 UnclosableStream unclosable
;
46 unclosable
= new UnclosableStream (stream
);
48 GZipOutputStream gz_out
;
49 gz_out
= new GZipOutputStream (unclosable
);
52 memory
= new MemoryStream ();
53 // There should just be one child
54 foreach (FileObject file
in Children
)
55 file
.AddToStream (memory
, tracker
);
56 gz_out
.Write (memory
.ToArray (), 0, (int) memory
.Length
);
62 override protected bool MatchesQueryPart (QueryPart part
)
64 // The only thing that could match is the name, and we check
65 // for that already in FileSystemObject.MatchesQuery.