TarArchive.SaveGzipped
Contents
[
Hide
]SaveGzipped(Stream, TarFormat?)
Saves archive to the stream with gzip compression.
public void SaveGzipped(Stream output, TarFormat? format = default)
| Parameter | Type | Description |
|---|---|---|
| output | Stream | Destination stream. |
| format | Nullable`1 | Defines the tar header format. Null value will be treated as USTar when possible. |
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | output is null. |
| ArgumentException | output is not writable. |
| ObjectDisposedException | Archive has been disposed and cannot be used |
Remarks
output must be writable.
Examples
using (FileStream result = File.OpenWrite("result.tar.gz"))
{
using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
using (var archive = new TarArchive())
{
archive.CreateEntry("entry.bin", source);
archive.SaveGzipped(result);
}
}
}
See Also
- enum TarFormat
- class TarArchive
- namespace Aspose.Zip.Tar
- assembly Aspose.Zip
SaveGzipped(string, TarFormat?)
Saves archive to the file by path with gzip compression.
public void SaveGzipped(string path, TarFormat? format = default)
| Parameter | Type | Description |
|---|---|---|
| path | String | The path of the archive to be created. If the specified file name points to an existing file, it will be overwritten. |
| format | Nullable`1 | Defines the tar header format. Null value will be treated as USTar when possible. |
Exceptions
| exception | condition |
|---|---|
| UnauthorizedAccessException | The caller does not have the required permission. -or- path specified a read-only file or directory. |
| ArgumentException | path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. |
| ArgumentNullException | path is null. |
| 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. |
| DirectoryNotFoundException | The specified path is invalid, (for example, it is on an unmapped drive). |
| NotSupportedException | path is in an invalid format. |
| ObjectDisposedException | Archive has been disposed and cannot be used |
Examples
using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
using (var archive = new TarArchive())
{
archive.CreateEntry("entry.bin", source);
archive.SaveGzipped("result.tar.gz");
}
}
See Also
- enum TarFormat
- class TarArchive
- namespace Aspose.Zip.Tar
- assembly Aspose.Zip