         try _process(Z_FINISH, callback)
     }
 }
-

    }
}

extension Deflate {
    
    public struct Level: RawRepresentable {
        
        public var rawValue: Int32
        
        public init(rawValue: Int32) {
            self.rawValue = rawValue
        }
        
        public static var `default` = Level(rawValue: Z_DEFAULT_COMPRESSION)
        public static var speed = Level(rawValue: Z_BEST_SPEED)
        public static var compact = Level(rawValue: Z_BEST_COMPRESSION)
        public static var noCompression = Level(rawValue: Z_NO_COMPRESSION)
    }
    
    public enum Error: Swift.Error {
        

//  THE SOFTWARE.
//

public class Deflate : _Z_STREAM {
    
    public init(level: Level = .default, windowBits: Int32 = MAX_WBITS, memLevel: Int32 = MAX_MEM_LEVEL, strategy: Strategy = .default) throws {
        try super.init()
        let status = deflateInit2_(&stream, level.rawValue, Z_DEFLATED, windowBits, memLevel, strategy.rawValue, ZLIB_VERSION, Int32(MemoryLayout<z_stream>.size))
        guard status == Z_OK else { throw Error(code: status, msg: stream.msg) }
    }
    
    deinit {
        deflateEnd(&stream)
    }
    
    fileprivate override func _z_stream_process(_ flush: Int32) -> Int32 {
        return deflate(&stream, flush)
    }
}

