GzipArchive.SetSource
SetSource(Stream)
Définit le contenu à compresser dans l’archive.
public void SetSource(Stream source)
Paramètre | Taper | La description |
---|---|---|
source | Stream | Le flux d’entrée pour l’archive. |
Exemples
using (var archive = new GzipArchive())
{
archive.SetSource(new MemoryStream(new byte[] { 0x00, 0xFF }));
archive.Save("archive.gz");
}
Voir également
- class GzipArchive
- espace de noms Aspose.Zip.Gzip
- Assemblée Aspose.Zip
SetSource(FileInfo)
Définit le contenu à compresser dans l’archive.
public void SetSource(FileInfo fileInfo)
Paramètre | Taper | La description |
---|---|---|
fileInfo | FileInfo | La référence à un fichier à compresser. |
Exemples
Ouvrez une archive à partir d’un flux et extrayez-la dans unMemoryStream
using (var archive = new GzipArchive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save("archive.gz");
}
Voir également
- class GzipArchive
- espace de noms Aspose.Zip.Gzip
- Assemblée Aspose.Zip
SetSource(string)
Définit le contenu à compresser dans l’archive.
public void SetSource(string path)
Paramètre | Taper | La description |
---|---|---|
path | String | Chemin d’accès au fichier à compresser. |
Exceptions
exception | condition |
---|---|
ArgumentNullException | path est nul. |
SecurityException | L’appelant n’a pas l’autorisation requise pour accéder. |
ArgumentException | Lepath est vide, ne contient que des espaces blancs ou contient des caractères non valides. |
UnauthorizedAccessException | Accéder au dossierpath est refusé. |
PathTooLongException | Le spécifiépath, nom de fichier ou les deux dépassent la longueur maximale définie par le système. Par exemple, sur les plates-formes Windows, les chemins doivent comporter moins de 248 caractères et les noms de fichiers doivent comporter moins de 260 caractères. |
NotSupportedException | Fichier àpath contient deux-points (:) au milieu de la chaîne. |
Exemples
Ouvrez une archive à partir d’un fichier par chemin et extrayez-la dans unMemoryStream
using (var archive = new GzipArchive())
{
archive.SetSource("data.bin");
archive.Save("archive.gz");
}
Voir également
- class GzipArchive
- espace de noms Aspose.Zip.Gzip
- Assemblée Aspose.Zip
SetSource(TarArchive)
Définit le contenu à compresser dans l’archive.
public void SetSource(TarArchive tarArchive)
Paramètre | Taper | La description |
---|---|---|
tarArchive | TarArchive | Archive tar à compresser. |
Remarques
Utilisez cette méthode pour composer une archive tar.gz conjointe.
Exemples
using (var tarArchive = new TarArchive())
{
tarArchive.CreateEntry("first.bin", "data1.bin");
tarArchive.CreateEntry("second.bin", "data2.bin");
using (var gzippedArchive = new GzipArchive())
{
gzippedArchive.SetSource(tarArchive);
gzippedArchive.Save("archive.tar.gz");
}
}
Voir également
- class TarArchive
- class GzipArchive
- espace de noms Aspose.Zip.Gzip
- Assemblée Aspose.Zip