Xceed .NET Libraries Documentation
Xceed.FileSystem Assembly / Xceed.FileSystem Namespace / StreamFile Class
Members Example


In This Topic
    StreamFile Class
    In This Topic
    Specialization of the AbstractFile class that implements access to any type of stream as though it were a file.
    Syntax
    'Declaration
     
    Public Class StreamFile 
       Inherits AbstractFile
    'Usage
     
    Dim instance As StreamFile
    public class StreamFile : AbstractFile 
    Example
    The following example demonstrates how to extract the contents of a zip file contained within the resources of an application to a local folder.
    ' Create a stream that access a zip file contained within the resources
    ' of an application.
    Dim resources As Stream = Me.GetType().Assembly.GetManifestResourceStream( "Resources.zip" )
    
    ' Initialize a new instance of the StreamFile class specifying the inner stream
    ' as well as the name of the file.
    Dim file As New StreamFile( resources, "Resources.zip" )
    
    ' Initialize a new instance of the ZipArchive class using 
    ' newly created StreamFile object.
    Dim zip As New ZipArchive( file )
    
    ' Copy files from the zip file contained within the resources to a local folder.
    zip.CopyFilesTo( New DiskFolder( "d:\Destination" ), false, true )
    // Create a stream that access a zip file contained within the resources
    // of an application.
    Stream resources = this.GetType().Assembly.GetManifestResourceStream( "Resources.zip" );
    
    // Initialize a new instance of the StreamFile class specifying the inner stream
    // as well as the name of the file.
    StreamFile file = new StreamFile( resources, "Resources.zip" );
    
    // Initialize a new instance of the ZipArchive class using 
    // newly created StreamFile object.
    ZipArchive zip = new ZipArchive( file );
    
    // Copy files from the zip file contained within the resources to a local folder.
    zip.CopyFilesTo( new DiskFolder( @"d:\Destination" ), false, true );
    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          Xceed.FileSystem.FileSystemItem
             Xceed.FileSystem.AbstractFile
                Xceed.FileSystem.StreamFile

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also