Dart.PowerTCP.Zip Namespace > Archive Class > Add Method : Add(Stream) Method |
<DescriptionAttribute("To add one stream item to the collection with encryption specification. ")> Public Overloads Sub Add( _ ByVal source As Stream _ )
[Description("To add one stream item to the collection with encryption specification. ")] public void Add( Stream source )
[Description("To add one stream item to the collection with encryption specification. ")] public: void Add( Stream* source )
[Description("To add one stream item to the collection with encryption specification. ")] public: void Add( Stream^ source )
Use this method to add a Stream (which could be a FileStream, MemoryStream, or any other type of .NET Stream) to the archive. Compress the Stream by using the Archive.Zip method.
The source stream is not altered by the Archive component. For example, after reading, the Archive component will not close the source stream.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip" ' at the top of your class. ' Add a file using the ArchiveItem constructor Dim item = New ArchiveItem("c:\Test\\file1.txt") ' Add a comment to this item item.Comment = "This is file1.txt" ' Use encryption for just this item item.Encryption = Encryption.Standard item.Password = "testme" Archive1.Add(item) ' Add a file using the filename. This could also be used for adding wildcard collections Archive1.Add("c:\Test\file2.log") ' Add a wildcard collection of files ' In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt" ' Subfolders are not included, but the paths are preserved. Archive1.IncludeSubs = True Archive1.ExcludePattern = "file1.txt" Archive1.PreservePath = True Archive1.Add("c:\Test\*.txt") ' zip the data Archive1.Zip("c:\test.zip")
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;" // at the top of your class. // Add a file using the ArchiveItem constructor ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt"); // Add a comment to this item item.Comment = "This is file1.txt"; // Use encryption for just this item item.Encryption = Encryption.Standard; item.Password = "testme"; archive1.Add(item); // Add a file using the filename. This could also be used for adding wildcard collections archive1.Add("c:\\Test\\file2.log"); // Add a wildcard collection of files // In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt" // Subfolders are not included, but the paths are preserved. archive1.IncludeSubs = true; archive1.ExcludePattern= "file1.txt"; archive1.PreservePath = true; archive1.Add("c:\\Test\\*.txt"); // Zip the data archive1.Zip("c:\\test.zip");