override public void AddToStream(Stream stream, EventTracker tracker) { if (ChildCount > 1) { throw new Exception("Bzip2 file " + Uri + " has " + ChildCount + " children"); } if (tracker != null) { tracker.ExpectingAdded(UriFu.UriToEscapedString(this.Uri)); } UnclosableStream unclosable; unclosable = new UnclosableStream(stream); BZip2OutputStream bz2_out; bz2_out = new BZip2OutputStream(unclosable); MemoryStream memory; memory = new MemoryStream(); // There should just be one child foreach (FileObject file in Children) { file.AddToStream(memory, tracker); } bz2_out.Write(memory.ToArray(), 0, (int)memory.Length); memory.Close(); bz2_out.Close(); }
/////////////////////////////////////////////////////////////////////// override public void AddOnDisk(EventTracker tracker) { string full_name; full_name = FullName; if (full_name == null) { throw new Exception("Attempt to instantiate something other than a real file: " + Uri); } if (is_root) { // Root directories must already exist. if (!Directory.Exists(full_name)) { throw new Exception("Missing root directory " + full_name); } } else { Directory.CreateDirectory(full_name); timestamp = Directory.GetLastWriteTimeUtc(full_name); } if (tracker != null) { tracker.ExpectingAdded(UriFu.UriToEscapedString(this.Uri)); } // Recursively add the children foreach (FileSystemObject fso in children.Values) { fso.AddOnDisk(tracker); } }
override public void AddToStream (Stream stream, EventTracker tracker) { if (tracker != null) tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri)); // We can't just use a StreamWriter here, since that // will close the underlying stream when it gets // disposed. UnclosableStream unclosable = new UnclosableStream (stream); StreamWriter writer = new StreamWriter (unclosable); foreach (string str in body) writer.WriteLine (str); writer.Close (); }
override public void AddToStream (Stream stream, EventTracker tracker) { if (tracker != null) tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri)); UnclosableStream unclosable; unclosable = new UnclosableStream (stream); ZipOutputStream zip_out; zip_out = new ZipOutputStream (unclosable); foreach (FileSystemObject fso in Children) WriteObjectToZip (zip_out, fso, tracker); zip_out.Finish (); zip_out.Close (); }
override public void AddToStream(Stream stream, EventTracker tracker) { if (tracker != null) { tracker.ExpectingAdded(UriFu.UriToEscapedString(this.Uri)); } // We can't just use a StreamWriter here, since that // will close the underlying stream when it gets // disposed. UnclosableStream unclosable = new UnclosableStream(stream); StreamWriter writer = new StreamWriter(unclosable); foreach (string str in body) { writer.WriteLine(str); } writer.Close(); }
override public void AddToStream(Stream stream, EventTracker tracker) { if (tracker != null) { tracker.ExpectingAdded(UriFu.UriToEscapedString(this.Uri)); } UnclosableStream unclosable; unclosable = new UnclosableStream(stream); ZipOutputStream zip_out; zip_out = new ZipOutputStream(unclosable); foreach (FileSystemObject fso in Children) { WriteObjectToZip(zip_out, fso, tracker); } zip_out.Finish(); zip_out.Close(); }
override public void AddToStream(Stream stream, EventTracker tracker) { if (tracker != null) { tracker.ExpectingAdded(UriFu.UriToEscapedString(this.Uri)); } UnclosableStream unclosable; unclosable = new UnclosableStream(stream); TarOutputStream tar_out; tar_out = new TarOutputStream(unclosable); foreach (FileSystemObject fso in Children) { WriteObjectToTar(tar_out, fso, tracker); } // This calls close on the underlying stream, // which is why we wrapped the stream in an // UnclosableStream. tar_out.Close(); }
override public void AddToStream (Stream stream, EventTracker tracker) { if (ChildCount > 1) throw new Exception ("Bzip2 file " + Uri + " has " + ChildCount + " children"); if (tracker != null) tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri)); UnclosableStream unclosable; unclosable = new UnclosableStream (stream); BZip2OutputStream bz2_out; bz2_out = new BZip2OutputStream (unclosable); MemoryStream memory; memory = new MemoryStream (); // There should just be one child foreach (FileObject file in Children) file.AddToStream (memory, tracker); bz2_out.Write (memory.ToArray (), 0, (int) memory.Length); memory.Close (); bz2_out.Close (); }
/////////////////////////////////////////////////////////////////////// override public void AddOnDisk (EventTracker tracker) { string full_name; full_name = FullName; if (full_name == null) throw new Exception ("Attempt to instantiate something other than a real file: " + Uri); if (is_root) { // Root directories must already exist. if (! Directory.Exists (full_name)) throw new Exception ("Missing root directory " + full_name); } else { Directory.CreateDirectory (full_name); timestamp = Directory.GetLastWriteTimeUtc (full_name); } if (tracker != null) tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri)); // Recursively add the children foreach (FileSystemObject fso in children.Values) fso.AddOnDisk (tracker); }
override public void AddToStream (Stream stream, EventTracker tracker) { if (tracker != null) tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri)); UnclosableStream unclosable; unclosable = new UnclosableStream (stream); TarOutputStream tar_out; tar_out = new TarOutputStream (unclosable); foreach (FileSystemObject fso in Children) WriteObjectToTar (tar_out, fso, tracker); // This calls close on the underlying stream, // which is why we wrapped the stream in an // UnclosableStream. tar_out.Close (); }