Welcome to the Xceed Community | Help
Community Search  
More Search Options

How do I read data from a stream to a zip file?

Sort Posts: Previous Next
  •  10-10-2008, 9:50 AM Post no. 28302

    How do I read data from a stream to a zip file?

    Yes. The best way to do it would be to create a StreamFile around your stream and call the StreamFile's CopyTo method. For example:

    byte[] data = System.Text.Encoding.Default.GetBytes( "This is the data in the sql db" );

    using( MemoryStream stream = new MemoryStream( data ) )
    {
        StreamFile file = new StreamFile( stream );
        file.Name = "file.ext";

        ZipArchive zip = new ZipArchive( new DiskFile( @"d:\test.exe" ) );
        zip.BeginUpdate();

        XceedSfxPrefix sfx = new XceedSfxPrefix( new DiskFile( @"C:\Program Files\Xceed Components\Xceed Zip Compression Library 5.0\Sfx\xcdsfx32.bin" ) );

        zip.SfxPrefix = sfx;

        file.CopyTo( zip, true );
        zip.EndUpdate();
    }
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.