   /// - bufferCapacity: capacity of the internal data buffer
   /// - readFunc: called to read the input data
   ///
-  /// - Throws: `FilterError.state` if filter initialization failed
+  /// - Throws: `FilterError.invalidState` if filter initialization failed
   public init(
     _ operation: FilterOperation,
     using algorithm: Algorithm,

  /// - Parameter operation: direction of operation
  /// - Parameter algorithm: compression algorithm
  ///
  /// - Throws: `FilterError.state` if `algorithm` is not supported
  ///           by the Compression stream API
  ///
  internal init(operation: FilterOperation, algorithm: Algorithm) throws {

    _stream.dst_size = _bufCapacity

    let status = compression_stream_process(&_stream, (finalize ? Int32(COMPRESSION_STREAM_FINALIZE.rawValue) : 0))
    guard status != COMPRESSION_STATUS_ERROR else { throw FilterError.invalidData }

    // Number of bytes written to buf
    let writtenBytes = _bufCapacity - _stream.dst_size
