SwiftZip Documentation Beta

Class Zip​Entry​Reader

public final class ZipEntryReader

A reader for the archive entry data stream.

Methods

close()

public func close()

Closes the file and invalidates ZipEntryReader instance.

read(buf:​count:​)

@discardableResult public func read(buf: UnsafeMutableRawPointer, count: Int) throws -> Int

Reads at most count bytes from file into buf. Returns number of bytes read.

Parameters

buf Unsafe​Mutable​Raw​Pointer

destination data buffer

count Int

buffer size

read(buf:​)

@discardableResult public func read(buf: UnsafeMutableRawBufferPointer) throws -> Int

Reads at most count bytes from file into buf. Returns number of bytes read.

Parameters

buf Unsafe​Mutable​Raw​Buffer​Pointer

destination data buffer

seek(offset:​relative​To:​)

public func seek(offset: Int, relativeTo whence: ZipWhence = .origin) throws

Seeks to the specified offset relative to whence, just like fseek(3)

Parameters

offset Int

relative offset

whence Zip​Whence

anchor point

tell()

public func tell() throws -> Int

Reports the current offset in the file. tell only works on uncompressed (stored) data. When called on compressed data it will throw an error.