 //  FPSStreamTask.swift
 //  FileProvider
 //
-//  Created by Amir Abbas Mousavian on 5/19/95.
-//
+//  Created by Amir Abbas Mousavian.
+//  Copyright © 2016 Mousavian. Distributed under MIT license.
 //
 
 import Foundation

    private var streamDelegate: FPSStreamDelegate? {
        return (_underlyingSession.delegate as? FPSStreamDelegate)
    }
    private var _underlyingTaskObject: NSURLSessionTask?
    private var _taskIdentifier: Int
    
    @available(iOS 9.0, OSX 10.11, *)
    internal var _underlyingTask: NSURLSessionStreamTask? {
        get {
            return _underlyingTaskObject as? NSURLSessionStreamTask
        }
        set {
            _underlyingTaskObject = newValue
        }
    }
    
    public override var taskIdentifier: Int {

                        completionHandler(nil, inputStream.streamStatus == .AtEnd, inputStream.streamError)
                    })
                }
                while (self.dataReceived.length == 0 || self.dataReceived.length < minBytes) && !timedOut {
                    NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow: 0.1));
                    NSThread.sleepForTimeInterval(0.1)
                }
