             return nil
         }
         
-        if let delimData = delimiter.dataUsingEncoding(encoding) {
-            self.delimData = delimData
+        if let delimData = delimiter.data(using: encoding) {
+            self.delimData = delimData as NSData!
         }else{
             return nil
         }


class StreamReader {
    
    let encoding:UInt
    let chunkSize: Int
    
    var fileHandle:NSFileHandle!
    let buffer:NSMutableData!
    let delimData:NSData!
    var atEOF:Bool = false
    
    
    init?(path:String, delimiter:String = "\n", encoding:UInt = NSUTF8StringEncoding, chunkSize:Int = 2048){
        self.encoding = encoding
        self.chunkSize = chunkSize
        
        if let fileHandle = NSFileHandle(forReadingAtPath: path) {
            self.fileHandle = fileHandle
        }else{
            return nil

            let prevOffset = fileHandle.offsetInFile
            fileHandle.seekToEndOfFile()
            let size = fileHandle.offsetInFile
            fileHandle.seek(toFileOffset: prevOffset)
            return size
        }
        
