CompressionLevel 열거형

정의

압축 작업에서 속도 또는 압축 크기를 강조하는지 여부를 나타내는 값을 지정합니다.

public enum class CompressionLevel
public enum CompressionLevel
type CompressionLevel = 
Public Enum CompressionLevel
상속
CompressionLevel

필드

Name Description
Optimal 0

압축 작업은 압축 속도와 출력 크기의 균형을 최적으로 조정해야 합니다.

Fastest 1

결과 파일이 최적으로 압축되지 않더라도 압축 작업은 가능한 한 빨리 완료되어야 합니다.

NoCompression 2

파일에서 압축을 수행해서는 안 됩니다.

SmallestSize 3

작업이 완료되는 데 시간이 더 오래 걸리더라도 압축 작업은 가능한 한 작은 출력을 만들어야 합니다.

설명

압축 작업에는 일반적으로 압축 속도와 효율성 간의 절충이 포함됩니다. 열거형을 CompressionLevel 사용하여 개발 시나리오에서 더 중요한 요소인 압축 작업을 완료하는 시간 또는 압축된 파일의 크기를 나타냅니다. 이러한 값은 특정 압축 수준에 해당하지 않습니다. 압축을 구현하는 개체는 압축을 처리하는 방법을 결정합니다.

다음 메서드의 DeflateStream, GZipStream, ZipArchiveZipFileZipFileExtensions 클래스에는 압축 수준을 지정할 수 있는 매개 변수가 compressionLevel 포함됩니다.

예제

다음 예제에서는 클래스를 사용하여 ZipFile zip 보관 파일을 만들 때 압축 수준을 설정하는 방법을 보여 있습니다.

using System;
using System.IO;
using System.IO.Compression;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string startPath = @"c:\example\start";
            string zipPath = @"c:\example\result.zip";

            ZipFile.CreateFromDirectory(startPath, zipPath, CompressionLevel.Fastest, true);
        }
    }
}
Imports System.IO
Imports System.IO.Compression

Module Module1

    Sub Main()
        Dim startPath As String = "c:\example\start"
        Dim zipPath As String = "c:\example\result.zip"

        ZipFile.CreateFromDirectory(startPath, zipPath, CompressionLevel.Fastest, True)
    End Sub

End Module

적용 대상