Class ComHelper

Class ComHelper

Namespace: Aspose.Zip
Assembly: Aspose.Zip.dll (26.3.0)

Provides methods for COM clients to load archives into Aspose.Zip.

public class ComHelper

Inheritance

object ComHelper

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Remarks

Use the ComHelper class to load an archive from a file or stream. Particular classes provide a default constructor to create a new archive and also provides overloaded constructors to load an archive from a file or stream. If you are using Aspose.Zip from a .NET application, you can use all the archive constructors directly, but if you are using Aspose.Zip from a COM application, only the default archive constructor is available.

Constructors

ComHelper()

Initializes a new instance of this class.

public ComHelper()

Methods

OpenBzip2(Stream)

Allows a COM application to load a bzip2 archive from a stream.

public Bzip2Archive OpenBzip2(Stream stream)

Parameters

stream Stream

A .NET stream object that contains the archive to load.

Returns

Bzip2Archive

A Aspose.Zip.Bzip2.Bzip2Archive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

InvalidDataException

Wrong signature bytes.

OpenBzip2(string)

Allows a COM application to load a bzip2 archive from a file.

public Bzip2Archive OpenBzip2(string fileName)

Parameters

fileName string

Filename of the archive to load.

Returns

Bzip2Archive

A Aspose.Zip.Bzip2.Bzip2Archive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

ArgumentException

The file name is empty, contains only white spaces, or contains invalid characters.

ArgumentNullException

fileName is null.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

FileNotFoundException

The file is not found.

InvalidDataException

Wrong signature bytes.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length.

UnauthorizedAccessException

Access to fileName is denied.

OpenGzip(Stream)

Allows a COM application to load a gzip archive from a stream.

public GzipArchive OpenGzip(Stream stream)

Parameters

stream Stream

A .NET stream object that contains the archive to load.

Returns

GzipArchive

A Aspose.Zip.Gzip.GzipArchive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

ArgumentNullException

Thrown when an stream is null.

InvalidDataException

Thrown when the data is invalid or corrupted.

OpenGzip(string)

Allows a COM application to load a gzip archive from a file.

public GzipArchive OpenGzip(string fileName)

Parameters

fileName string

Filename of the archive to load.

Returns

GzipArchive

A Aspose.Zip.Gzip.GzipArchive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

ArgumentException

The file name is empty, contains only white spaces, or contains invalid characters.

ArgumentNullException

fileName is null.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

FileNotFoundException

The file is not found.

InvalidDataException

Thrown when the data is invalid or corrupted.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length.

UnauthorizedAccessException

Access to fileName is denied.

OpenRar(Stream)

Allows a COM application to load a rar archive from a stream.

public RarArchive OpenRar(Stream stream)

Parameters

stream Stream

A .NET stream object that contains the archive to load.

Returns

RarArchive

A Aspose.Zip.Rar.RarArchive object that represents the archive.

Exceptions

InvalidDataException

Thrown when the data is invalid or corrupted.

OpenRar(string)

Allows a COM application to load a rar archive from a file.

public RarArchive OpenRar(string fileName)

Parameters

fileName string

Filename of the archive to load.

Returns

RarArchive

A Aspose.Zip.Rar.RarArchive object that represents the archive.

Exceptions

ArgumentException

The file name is empty, contains only white spaces, or contains invalid characters.

ArgumentNullException

fileName is null.

Exception

Thrown when a runtime error occurs.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

FileNotFoundException

The file is not found.

InvalidDataException

Thrown when the data is invalid or corrupted.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length.

UnauthorizedAccessException

Access to fileName is denied.

OpenZip(Stream)

Allows a COM application to load a ZIP archive from a stream.

public Archive OpenZip(Stream stream)

Parameters

stream Stream

A .NET stream object that contains the archive to load.

Returns

Archive

A Aspose.Zip.Archive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

OpenZip(string)

Allows a COM application to load a ZIP archive from a file.

public Archive OpenZip(string fileName)

Parameters

fileName string

Filename of the archive to load.

Returns

Archive

A Aspose.Zip.Archive object that represents the archive.

Exceptions

EndOfStreamException

Thrown when the end of the stream is reached before the expected number of bytes are read.

ArgumentException

The file name is empty, contains only white spaces, or contains invalid characters.

ArgumentNullException

fileName is null.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

FileNotFoundException

The file is not found.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length.

UnauthorizedAccessException

Access to fileName is denied.

 English