 
     var buffer = [Int8]()
 
+    var reading = true
+
     func flush() -> [Int8]? {
         let size = buffer.count
         for i in 0..<size {

            throw ReaderError.GenericError(error: errno)
        }
        var bytes = [Int8]()
        for i in 0..<maxLength {
            bytes.append(buffer[i])
        }
        buffer.dealloc(maxLength)

        if let line = flush() {
            return line
        }
        let batch = 128
        while reading {
            let chunk = try reader.read(batch)
            if chunk.count == 0 {
                reading = false
            }
            else if chunk.count < batch {
                reading = false
            }
            buffer.appendContentsOf(chunk)
            if let line = flush() {
                return line
            }
        }
        if buffer.count > 0 {
            let line = buffer
            buffer.removeAll()
            return line
        }
        return nil
    }

    func read(maxLength: Int) throws -> [[Int8]] {
