forked from johanhenselmans/fosdem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LADownload.h
53 lines (35 loc) · 1.38 KB
/
LADownload.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Adam Ziolkowski <adam@adsized.com> and Leon Handreke <leon.handreke@gmail.com>
* wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy us a beer in return.
* ----------------------------------------------------------------------------
*/
#import <Foundation/Foundation.h>
@interface LADownload : NSObject {
NSURLRequest *request;
NSString *destination;
NSURLConnection *connection;
double totalLength;
NSMutableData *downloadedData;
double receivedLength;
}
- (LADownload *) initWithRequest: (NSURLRequest *) newRequest destination: (NSString *) newDestination delegate: (id) newDelegate;
- (double) progress;
- (void) start;
- (void) cancel;
@property (readonly) double totalLength;
@property (retain) id delegate;
@property (retain) NSURLRequest *request;
@property (retain) NSString *destination;
@property (readonly) double receivedLength;
@property (retain) NSFileHandle *fileHandle;
@end
// The delegate interface
@interface NSObject (LADownload)
- (void)downloadDidFinish: (LADownload *) download;
- (void)download: (LADownload *) download didReceiveDataOfLength: (NSUInteger) dataLength;
// etc...
@end