 
 import UIKit
 
+/// A subclass of UIImageView which displays a JPEG progressively while it is downloaded
 public class CCBufferedImageView : UIImageView, NSURLConnectionDataDelegate {
     private weak var connection: NSURLConnection?
     private let defaultContentLength = 5 * 1024 * 1024

        data = NSMutableData(capacity: contentLength)
    }

    public func connectionDidFinishLoading(connection: NSURLConnection) {
        data = nil
    }

        image = decoder.toImage()
    }

    /// see NSURLConnectionDataDelegate
    public func connection(connection: NSURLConnection, didReceiveResponse response: NSURLResponse) {
        var contentLength = Int(response.expectedContentLength)
        if contentLength < 0 {
