Structure
ArArchiveReader
public struct ArArchiveReader
ArArchiveReader
reads ar
files.
let archiveData: Data = ...
let reader = ArArchiveReader(archive: Array(archiveData))
print("Name: \(reader.headers[0])")
print("Contents:\n \(String(reader[0]))")
Relationships
Conforms To
Sequence
Initializers
init(archive:)
public init(archive: [UInt8]) throws
The initializer reads all the ar
headers in preparation for random access to the header's file contents later.
Parameters
Name | Type | Description |
---|---|---|
archive | [UInt8] |
The bytes of the archive you want to read. |
Throws
ArArchiveError
.
Properties
headers
public var headers: [Header] = []
The headers that describe the files in this archive.
Use this to find a file in the archive, then use the provided subscript to get the bytes of the file.
let bytes = Array<UInt8>(try Data(contentsOf: myURL))
let reader = try ArArchiveReader(archive: bytes)
let bytes = reader[header: reader.headers[0]]
// Use bytes...
Methods
makeIterator()
public func makeIterator() -> ArArchiveReaderIterator