mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
39 lines
929 B
Swift
39 lines
929 B
Swift
// Copyright (c) 2026 Timofey Solomko
|
|
// Licensed under MIT License
|
|
//
|
|
// See LICENSE for license information
|
|
|
|
import BitByteData
|
|
|
|
class SevenZipStreamInfo {
|
|
|
|
var packInfo: SevenZipPackInfo?
|
|
var coderInfo: SevenZipCoderInfo
|
|
var substreamInfo: SevenZipSubstreamInfo?
|
|
|
|
init(_ bitReader: MsbBitReader) throws {
|
|
var type = bitReader.byte()
|
|
|
|
if type == 0x06 {
|
|
packInfo = try SevenZipPackInfo(bitReader)
|
|
type = bitReader.byte()
|
|
}
|
|
|
|
if type == 0x07 {
|
|
coderInfo = try SevenZipCoderInfo(bitReader)
|
|
type = bitReader.byte()
|
|
} else {
|
|
coderInfo = SevenZipCoderInfo()
|
|
}
|
|
|
|
if type == 0x08 {
|
|
substreamInfo = try SevenZipSubstreamInfo(bitReader, coderInfo)
|
|
type = bitReader.byte()
|
|
}
|
|
|
|
guard type == 0x00
|
|
else { throw SevenZipError.internalStructureError }
|
|
}
|
|
|
|
}
|