TarArchive.TarArchive
Contents
[
Hide
]TarArchive()
Initializes a new instance of the TarArchive
class.
public TarArchive()
Examples
The following example shows how to compress a file.
using (var archive = new TarArchive())
{
archive.CreateEntry("first.bin", "data.bin");
archive.Save("archive.tar");
}
See Also
- class TarArchive
- namespace Aspose.Zip.Tar
- assembly Aspose.Zip
TarArchive(Stream)
Initializes a new instance of the Archive
class and composes entries list can be extracted from the archive.
public TarArchive(Stream sourceStream)
Parameter | Type | Description |
---|---|---|
sourceStream | Stream | The source of the archive. It must be seekable. |
Exceptions
exception | condition |
---|---|
InvalidDataException | sourceStream is not seekable. |
Remarks
This constructor does not unpack any entry. See Open
method for unpacking.
Examples
The following example shows how to extract all of the entries to a directory.
using (var archive = new TarArchive(File.OpenRead("archive.tar")))
{
archive.ExtractToDirectory("C:\extracted");
}
See Also
- class TarArchive
- namespace Aspose.Zip.Tar
- assembly Aspose.Zip
TarArchive(string)
Initializes a new instance of the TarArchive
class and composes entries list can be extracted from the archive.
public TarArchive(string path)
Parameter | Type | Description |
---|---|---|
path | String | The path to the archive file. |
Exceptions
exception | condition |
---|---|
ArgumentNullException | path is null. |
SecurityException | The caller does not have the required permission to access. |
ArgumentException | The path is empty, contains only white spaces, or contains invalid characters. |
UnauthorizedAccessException | Access to file path is denied. |
PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. |
NotSupportedException | File at path contains a colon (:) in the middle of the string. |
FileNotFoundException | The file is not found. |
DirectoryNotFoundException | The specified path is invalid, such as being on an unmapped drive. |
IOException | The file is already open. |
Remarks
This constructor does not unpack any entry. See Open
method for unpacking.
Examples
The following example shows how to extract all of the entries to a directory.
using (var archive = new TarArchive("archive.tar"))
{
archive.ExtractToDirectory("C:\extracted");
}
See Also
- class TarArchive
- namespace Aspose.Zip.Tar
- assembly Aspose.Zip