Class Bzip2Archive
이름 공간 : Aspose.Zip.Bzip2 모임: Aspose.Zip.dll (25.5.0)
이 클래스는 bzip2 아카이브 파일을 나타냅니다. bzip2 아카이브를 구성하거나 추출하는 데 사용하십시오.
public class Bzip2Archive : IArchive, IDisposable, IArchiveFileEntry
Inheritance
Implements
IArchive , IDisposable , IArchiveFileEntry
상속 회원들
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Remarks
bzip2는 Burrows-Wheeler 블록 텍스트 압축 알고리즘을 사용하여 파일을 압축하고 Huffman 코딩을 사용합니다.더 보기: https://en.wikipedia.org/wiki/Bzip2
Constructors
Bzip2Archive()
압축을 위해 준비된 Aspose.Zip.Bzip2.Bzip2Archive 클래스의 새로운 사례를 시작합니다.
public Bzip2Archive()
Examples
다음 예제는 파일을 압축하는 방법을 보여줍니다.
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save("archive.bz2");
}
Bzip2Archive(스트림, Bzip2LoadOptions)
Aspose.Zip.Bzip2.Bzip2Archive 클래스의 새로운 사례를 시작합니다.
public Bzip2Archive(Stream sourceStream, Bzip2LoadOptions loadOptions = null)
Parameters
sourceStream
Stream
아카이브의 출처입니다.
loadOptions
Bzip2LoadOptions
아카이브를 업로드 할 수있는 옵션.
Examples
흐름에서 아카이브를 열고 그것을 추출합니다.
var ms = new MemoryStream();
using (Bzip2Archive archive = new Bzip2Archive(File.OpenRead("archive.bz2")))
archive.Open().CopyTo(ms);
Remarks
이 건축기는 압축하지 않습니다. Aspose.Zip.Bzip2.Bzip2Archive.Open 방법을 참조하십시오.
Exceptions
초기 스트림 종료
잘못된 서명 바이트
Bzip2Archive(링크, Bzip2LoadOptions)
Aspose.Zip.Bzip2.Bzip2Archive 클래스의 새로운 사례를 시작합니다.
public Bzip2Archive(string path, Bzip2LoadOptions loadOptions = null)
Parameters
path
string
아카이브 파일로 가는 길입니다.
loadOptions
Bzip2LoadOptions
아카이브를 업로드 할 수있는 옵션.
Examples
파일에서 파일을 길로 열고 그것을 추출합니다.
var ms = new MemoryStream();
using (Bzip2Archive archive = new Bzip2Archive("archive.bz2"))
archive.Open().CopyTo(ms);
Remarks
이 건축기는 압축하지 않습니다. Aspose.Zip.Bzip2.Bzip2Archive.Open 방법을 참조하십시오.
Exceptions
path’ is null.
호출자는 필요한 액세스 허가를 가지고 있지 않습니다.
path’는 텅 비어 있고, 흰색 공간만 포함하거나, 불가능한 문자를 포함합니다.
path" 파일에 대한 액세스는 거부됩니다.
지정된 path’, 파일 이름, 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.
path’에 있는 파일에는 링의 중간에 있는 열(:)이 포함되어 있습니다.
파일은 찾을 수 없습니다.
지정된 경로는 불가능하며, 예를 들어 지정되지 않은 드라이브에 있습니다.
파일은 이미 열려 있습니다.
초기 스트림 종료
잘못된 서명 바이트
Methods
Dispose()
응용 프로그램으로 정의된 작업을 수행하며, 관리되지 않은 자원을 배출, 배출 또는 재배치하는 것과 관련이 있습니다.
public void Dispose()
Dispose(바울)
응용 프로그램으로 정의된 작업을 수행하며, 관리되지 않은 자원을 배출, 배출 또는 재배치하는 것과 관련이 있습니다.
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
관리된 자원이 낭비되어야 한다.
Extract(Stream)
아카이브를 제공하는 스트림으로 추출합니다.
public void Extract(Stream destination)
Parameters
destination
Stream
목적지 흐름.그것은 쓸 수 있어야합니다.
Examples
using (Bzip2Archive archive = new Bzip2Archive("archive.bz2"))
{
archive.Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
Extract(스트리트)
파일을 경로에 따라 파일로 추출합니다.
public FileInfo Extract(string path)
Parameters
path
string
목적지 파일의 경로.이 파일이 이미 존재한다면, 그것은 과장됩니다.
Returns
추출된 파일에 대한 정보
Exceptions
path’ is null.
호출자는 필요한 액세스 허가를 가지고 있지 않습니다.
path’는 텅 비어 있고, 흰색 공간만 포함하거나, 불가능한 문자를 포함합니다.
path" 파일에 대한 액세스는 거부됩니다.
지정된 path’, 파일 이름, 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.
path’에 있는 파일에는 링의 중간에 있는 열(:)이 포함되어 있습니다.
파일은 찾을 수 없습니다.
지정된 경로는 불가능하며, 예를 들어 지정되지 않은 드라이브에 있습니다.
파일은 이미 열려 있습니다.
ExtractToDirectory(스트리트)
아카이브의 내용을 제공된 디렉토리로 추출합니다.
public void ExtractToDirectory(string destinationDirectory)
Parameters
destinationDirectory
string
디렉토리로 이동하여 추출된 파일을 입력합니다.
Remarks
디렉토리가 존재하지 않는다면, 그것은 만들어집니다.
Exceptions
destinationDirectory’ is null.
지정된 경로, 파일 이름 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.
호출자는 기존 디렉토리에 액세스 할 수있는 필요한 허가를 가지고 있지 않습니다.
디렉토리가 존재하지 않는 경우, 경로는 드라이브 라벨의 일부가 아닌 척추 캐릭터 (:)를 포함합니다 (“C:”).
destinationDirectory’ is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method.-or- path is prefixed with, or contains, only a colon character (:).
경로에 의해 지정된 디렉토리는 파일입니다. -or- 네트워크 이름은 알려지지 않습니다.
Open()
추출을 위해 아카이브를 열고 아카이브 콘텐츠와 함께 흐름을 제공합니다.
public Stream Open()
Returns
아카이브의 내용을 나타내는 스트림.
Examples
사용하기 :Stream decompressed = archive.Open();
.NET 4.0 및 그 이상 - Stream.CopyTo 방법을 사용하십시오 :decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 및 이전 - 바이트를 수동으로 복사합니다.
byte[] buffer = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
fileStream.Write(buffer, 0, bytesRead);
```</p>
#### Remarks
Read from the stream to get the original content of the file. See examples section.
### <a id="Aspose_Zip_Bzip2_Bzip2Archive_Save_System_IO_Stream_Aspose_Zip_Bzip2_Bzip2SaveOptions_"></a> Save\(Stream, Bzip2SaveOptions\)
Saves archive to the stream provided.
```csharp
public void Save(Stream outputStream, Bzip2SaveOptions saveOptions = null)
Parameters
outputStream
Stream
목적지 흐름
saveOptions
Bzip2SaveOptions
bzip2 아카이브를 저장할 수 있는 옵션. 지정되지 않으면 900Kb 블록 크기가 사용될 것입니다.
Examples
압축된 데이터를 http 응답 스트림으로 작성합니다.
using (var archive = new Bzip2Archive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save(httpResponse.OutputStream);
}
Remarks
글쓰기가 있어야 합니다.
Exceptions
아카이브해야 할 데이터의 출처는 제공되지 않았습니다.
outputStream’ is not writable.
파일 출처는 독점적으로 읽거나 디렉토리입니다.
지정된 파일 출처 경로는 불가능하며, 예를 들어 지정되지 않은 드라이브에 있습니다.
파일 출처는 이미 열려 있습니다.
Save(링크, Bzip2SaveOptions)
제공된 목적지 파일에 아카이브를 저장합니다.
public void Save(string destinationFileName, Bzip2SaveOptions saveOptions = null)
Parameters
destinationFileName
string
만약 지정된 파일 이름이 기존 파일을 지정한다면, 그것은 과장됩니다.
saveOptions
Bzip2SaveOptions
bzip2 아카이브를 저장할 수 있는 옵션. 지정되지 않으면 900Kb 블록 크기가 사용될 것입니다.
Examples
압축된 데이터를 파일로 작성합니다.
using (var archive = new Bzip2Archive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save("data.bz2");
}
Exceptions
destinationFileName’ is null.
호출자는 필요한 액세스 허가를 가지고 있지 않습니다.
destinationFileName’는 텅 비어 있고, 단지 흰색 공간만 포함되어 있거나, 부적절한 문자를 포함합니다.
destinationFileName’ 파일에 대한 액세스는 거부됩니다.
지정된 destinationFileName’, 파일 이름, 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.
destinationFileName’에 있는 파일에는 라인의 중간에 있는 열(:)이 포함되어 있습니다.
SetSource(Stream)
아카이브 내에서 압축되어야 하는 콘텐츠를 설정합니다.
public void SetSource(Stream source)
Parameters
source
Stream
아카이브에 대한 입력 스트림.
Examples
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource(new MemoryStream(new byte[] { 0x00,0xFF }));
archive.Save("archive.bz2");
}
SetSource(FileInfo)
아카이브 내에서 압축되어야 하는 콘텐츠를 설정합니다.
public void SetSource(FileInfo fileInfo)
Parameters
fileInfo
FileInfo
압축되어야 할 파일에 대한 참조.
Examples
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save("archive.bz2");
}
SetSource(스트리트)
아카이브 내에서 압축되어야 하는 콘텐츠를 설정합니다.
public void SetSource(string path)
Parameters
path
string
파일을 압축하는 방법입니다.
Examples
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save("archive.bz2");
}
Exceptions
path’ is null.
호출자는 필요한 액세스 허가를 가지고 있지 않습니다.
path’는 텅 비어 있고, 흰색 공간만 포함하거나, 불가능한 문자를 포함합니다.
path" 파일에 대한 액세스는 거부됩니다.
지정된 path’, 파일 이름, 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.
path’에 있는 파일에는 링의 중간에 있는 열(:)이 포함되어 있습니다.
SetSource(카테고리, TarFormat)
아카이브 내에서 압축되어야 하는 콘텐츠를 설정합니다.
public void SetSource(TarArchive tarArchive, TarFormat format = TarFormat.UsTar)
Parameters
tarArchive
TarArchive
타르 아카이브가 압축되어야 합니다.
format
TarFormat
타르 헤더 형식을 정의합니다.
Examples
using (var tarArchive = new TarArchive())
{
tarArchive.CreateEntry("first.bin", "data1.bin");
tarArchive.CreateEntry("second.bin", "data2.bin");
using (var bzippedArchive = new Bzip2Archive())
{
bzippedArchive.SetSource(tarArchive);
bzippedArchive.Save("archive.tar.bz2");
}
}
Remarks
이 방법을 사용하여 공동 tar.bz2 아카이브를 구성합니다.
SetSource(Cpio아카이브, CpioFormat)
아카이브 내에서 압축되어야 하는 콘텐츠를 설정합니다.
public void SetSource(CpioArchive cpioArchive, CpioFormat format = CpioFormat.OldAscii)
Parameters
cpioArchive
CpioArchive
Cpio 아카이브가 압축됩니다.
format
CpioFormat
cpio header 형식을 정의합니다.
Examples
using (var cpioArchive = new CpioArchive())
{
cpioArchive.CreateEntry("first.bin", "data1.bin");
cpioArchive.CreateEntry("second.bin", "data2.bin");
using (var bzippedArchive = new Bzip2Archive())
{
bzippedArchive.SetSource(cpioArchive);
bzippedArchive.Save("archive.cpio.bz2");
}
}
Remarks
이 방법을 사용하여 공동 cpio.bz2 아카이브를 구성합니다.