Class ArchiveEntry

Class ArchiveEntry

이름 공간 : Aspose.Zip 모임: Aspose.Zip.dll (25.5.0)

아카이브 내에서 단일 파일을 나타냅니다.

public abstract class ArchiveEntry : IArchiveFileEntry

Inheritance

object ArchiveEntry

Derived

ArchiveEntryEncrypted , ArchiveEntryPlain

Implements

IArchiveFileEntry

상속 회원들

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Remarks

Aspose.Zip.ArchiveEntry 예제를 Aspose.Zip.ArchiveEntry에 암호화하여 입력이 암호화되었는지 여부를 결정합니다.

Constructors

ArchiveEntry(스트리트, CompressionSettings, Func윈도우)

Aspose.Zip.ArchiveEntry 클래스의 새로운 사례를 시작합니다.

protected ArchiveEntry(string name, CompressionSettings compressionSettings, Func<stream> sourceProvider, uint fileAttributes)

Parameters

name string

입장 이름

compressionSettings CompressionSettings

압축 또는 압축을 위한 설정.

sourceProvider Func &lt에 대한 정보 Stream >

입력 데이터와 함께 흐름을 반환하는 방법은 압축됩니다.

fileAttributes uint

파일 시스템의 속성.

ArchiveEntry(스트리트, CompressionSettings, Stream, uint, FileSystemInfo)

Aspose.Zip.ArchiveEntry 클래스의 새로운 사례를 시작합니다.

protected ArchiveEntry(string name, CompressionSettings compressionSettings, Stream source, uint fileAttributes, FileSystemInfo fileInfo = null)

Parameters

name string

입장 이름

compressionSettings CompressionSettings

압축 또는 압축을 위한 설정.

source Stream

입력 데이터가 압축되거나 압축되도록 유도됩니다.

fileAttributes uint

파일 시스템의 속성.

fileInfo FileSystemInfo

파일 또는 디렉토리 정보를 입력 기반으로 합니다.

Properties

Comment

이 게시물을 즐겨찾기로 설정 6월 19 Get comment of the entry within the archive.

public string Comment { get; protected set; }

부동산 가치

string

CompressedSize

압축된 파일의 크기를 얻습니다.

public ulong CompressedSize { get; }

부동산 가치

ulong

CompressionSettings

압축 또는 압축을 위한 설정이 있습니다.

public CompressionSettings CompressionSettings { get; }

부동산 가치

CompressionSettings

DataSource

입력에 대한 출처는 입력이 아카이브에 추가되었을 경우, 추출되지 않습니다.

public Stream DataSource { get; }

부동산 가치

Stream

Remarks

이 소스는 일부 경우 ‘Archive.Save’ 방법 내에서 할당 될 수 있습니다.

FileAttributes

호스트 시스템에서 파일 속성을 얻습니다.

protected FileAttributes FileAttributes { get; }

부동산 가치

FileAttributes

IsDirectory

입력이 디렉토리를 나타내는지 여부를 나타내는 값을 얻습니다.

public bool IsDirectory { get; }

부동산 가치

bool

ModificationTime

마지막으로 변경된 날짜와 시간을 얻거나 설정합니다.

public DateTime ModificationTime { get; set; }

부동산 가치

DateTime

Name

아카이브 내에서 입력의 이름을 얻습니다.

public string Name { get; protected set; }

부동산 가치

string

UncompressedSize

원본 파일의 크기를 얻습니다.

public ulong UncompressedSize { get; }

부동산 가치

ulong

Methods

Extract(스트링, 스트링)

제공된 경로를 통해 파일 시스템에 입력을 추출합니다.

public FileInfo Extract(string path, string password = null)

Parameters

path string

목적지 파일의 경로.이 파일이 이미 존재한다면, 그것은 과장됩니다.

password string

암호 해독을 위한 선택적 암호.

Returns

FileInfo

구성된 파일의 파일 정보.

Examples

zip 아카이브의 두 개의 입력, 각각 자신의 암호로 추출

using (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
    using (Archive archive = new Archive(zipFile))
    {
        archive.Entries[0].Extract("first.bin", "first_pass");
        archive.Entries[1].Extract("second.bin", "second_pass");
    }
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

호출자는 필요한 액세스 허가를 가지고 있지 않습니다.

ArgumentException

path’는 텅 비어 있고, 흰색 공간만 포함하거나, 불가능한 문자를 포함합니다.

UnauthorizedAccessException

path" 파일에 대한 액세스는 거부됩니다.

PathTooLongException

지정된 path’, 파일 이름, 또는 둘 다 시스템에 의해 정의 된 최대 길이를 초과합니다.예를 들어, Windows 기반 플랫폼에서 경로는 248 문자 미만이어야하며 파일 이름은 260 문자 미만이어야합니다.

NotSupportedException

path’에 있는 파일에는 링의 중간에 있는 열(:)이 포함되어 있습니다.

FileNotFoundException

파일은 찾을 수 없습니다.

DirectoryNotFoundException

지정된 경로는 불가능하며, 예를 들어 지정되지 않은 드라이브에 있습니다.

IOException

파일은 이미 열려 있습니다.

InvalidDataException

데이터가 부패합니다. -or- CRC 또는 MAC 검증이 입력에 실패했습니다.

Extract(스트리밍, 스트리밍)

제공되는 흐름에 입구를 추출합니다.

public void Extract(Stream destination, string password = null)

Parameters

destination Stream

목적지 흐름.그것은 쓸 수 있어야합니다.

password string

암호 해독을 위한 선택적 암호.

Examples

암호로 zip 아카이브의 입력을 추출합니다.

using (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
    using (Archive archive = new Archive(zipFile))
    {
        archive.Entries[0].Extract(httpResponseStream, "p@s$");
    }
}

Exceptions

InvalidDataException

데이터가 부패합니다. -or- CRC 또는 MAC 검증이 입력에 실패했습니다.

IOException

출처가 부패하거나 읽을 수 없습니다.

ArgumentException

destination’ does not support writing.

Open(스트리트)

추출을위한 입력을 열고 압축 된 입력 콘텐츠로 흐름을 제공합니다.

public Stream Open(string password = null)

Parameters

password string

암호 해독을 위한 선택적 암호.

Returns

Stream

입력의 내용을 나타내는 흐름.

Examples

사용하기 :Stream decompressed = entry.Open();

.NET 4.0 및 그 이상 - Stream.CopyTo 방법을 사용하십시오 :decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 및 이전 - 바이트를 수동으로 복사합니다.

byte[] buffer = new byte[8192];
int bytesRead;
while (0 &lt; (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
 fileStream.Write(buffer, 0, bytesRead);
```</p>

#### Remarks

<p>Read from the stream to get the original content of a file. See examples section.</p>

#### Exceptions

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

The archive is in an incorrect state.

### <a id="Aspose_Zip_ArchiveEntry_CompressionProgressed"></a> CompressionProgressed

Raises when a portion of raw stream compressed.

```csharp
public event EventHandler<progresseventargs> CompressionProgressed

이벤트 유형

EventHandler &lt에 대한 정보 ProgressEventArgs >

Examples

archive.Entries[0].CompressionProgressed += (s, e) =&gt; { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };

Remarks

이벤트 송신자는 Aspose.Zip.ArchiveEntry 인스턴스입니다.

ExtractionProgressed

원료 흐름의 일부가 추출되면 증가합니다.

public event EventHandler<progresseventargs> ExtractionProgressed

이벤트 유형

EventHandler &lt에 대한 정보 ProgressEventArgs >

Examples

archive.Entries[0].ExtractionProgressed += (s, e) =&gt; { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); };

Remarks

이벤트 송신자는 Aspose.Zip.ArchiveEntry 인스턴스입니다.

 한국어