mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
25 lines
650 B
Swift
25 lines
650 B
Swift
// Copyright (c) 2026 Timofey Solomko
|
|
// Licensed under MIT License
|
|
//
|
|
// See LICENSE for license information
|
|
|
|
extension CompressionMethod {
|
|
|
|
init(_ coderID: [UInt8]) {
|
|
if coderID == [0x00] || coderID == [0x04, 0x01, 0x00] {
|
|
self = .copy
|
|
} else if coderID == [0x04, 0x01, 0x08] {
|
|
self = .deflate
|
|
} else if coderID == [0x04, 0x01, 0x0C] || coderID == [0x04, 0x02, 0x02] {
|
|
self = .bzip2
|
|
} else if coderID == [0x21] {
|
|
self = .lzma2
|
|
} else if coderID == [0x03, 0x01, 0x01] {
|
|
self = .lzma
|
|
} else {
|
|
self = .other
|
|
}
|
|
}
|
|
|
|
}
|