Xceed Real-Time Zip for .NET Documentation
AllowInputStreamClosure Property
Example 


Xceed.Zip Assembly > Xceed.Zip.ReaderWriter Namespace > ZipReader Class : AllowInputStreamClosure Property
Gets or sets a boolean value indicating whether the input stream can be closed by the object.
Syntax
'Declaration
 
Public Property AllowInputStreamClosure As Boolean
'Usage
 
Dim instance As ZipReader
Dim value As Boolean
 
instance.AllowInputStreamClosure = value
 
value = instance.AllowInputStreamClosure
public bool AllowInputStreamClosure {get; set;}

Property Value

true if the input stream can be closed by the object; false otherwise. By default, false.

Remarks

Since ZipReader does not create the input stream it is given, it does not close it when the unzip operation is finished.

However, there are situations where it is convenient to close the input stream when ZipReader is done. This is especially true when the input stream is exclusively tied to the ZipReader, is not needed afterwards, and ZipReader is wrapped in a "using" statement (see example).

In these cases, setting the property to true will make ZipReader close the input stream when Dispose is called.

When the property is set to true, it allows for cleanup of both ZipReader and the input stream in one "using" statement.

When the property is set to false, it is your responsibility to close the input stream once ZipReader is done with it.

Example

When the property is set to true, it allows for cleanup of both ZipReader and the input stream in one 'using' statement (Example 1).

When the property is set to false, it is your responsibility to close the input stream once ZipReader is done with it (Example 2).

using( ZipReader reader = new ZipReader( new SomeInputStream(), true ) )
{
  // Use 'reader'
}
Using reader As New ZipReader(New SomeInputStream(), True)
  ' Use 'reader'
End Using
using( Stream inputStream = new SomeInputStream() )
{
  using( ZipReader reader = new ZipReader( inputStream, false ) )
  {
    // Use 'reader'
  }
}
Using inputStream As Stream = New SomeInputStream()
  Using reader As New ZipReader(inputStream, False)
    ' Use 'reader'
  End Using
End Using
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

Reference

ZipReader Class
ZipReader Members