DTDownload Class Reference
Inherits from | NSObject |
Declared in | DTDownload.h |
Overview
A Class that represents a download of a file from a remote server. It also supports only getting a HEAD on the given URL and optionally resume an interrupted download
Tasks
Getting Information about Downloads
-
URL
property -
downloadEntityTag
property -
contentType
property -
expectedContentLength
property -
lastModifiedDate
property -
context
property -
additionalHTTPHeaders
property -
delegate
property
Initializing a Download Object
-
– initWithURL:
-
– initWithURL:withDestinationPath:
-
– initWithURL:withDestinationFile:
-
+ downloadForURL:atPath:
Starting the Download
Block Handlers
-
responseHandler
property -
completionHandler
property
Properties
URL
Returns the URL that is being downloaded by the receiver.
@property (nonatomic, strong, readonly) NSURL *URL
Declared In
DTDownload.h
additionalHTTPHeaders
Using for HTTP headers parameters. For example, basic http authentification
@property (nonatomic, copy) NSDictionary *additionalHTTPHeaders
See Also
Declared In
DTDownload.h
completionHandler
Sets the block to execute as soon as the download has completed.
@property (nonatomic, copy) DTDownloadCompletionHandler completionHandler
Declared In
DTDownload.h
contentType
Returns the MIME type of the downloading file.
@property (nonatomic, strong, readonly) NSString *contentType
Declared In
DTDownload.h
context
Use to set or retrieve an object that provides a context for the download.
@property (nonatomic, strong) id context
Declared In
DTDownload.h
delegate
Returns the receiver’s delegate.
@property (nonatomic, assign) id<DTDownloadDelegate> delegate
See Also
Declared In
DTDownload.h
downloadEntityTag
Returns the entity tag of the downloading file.
@property (nonatomic, strong, readonly) NSString *downloadEntityTag
Declared In
DTDownload.h
expectedContentLength
Returns the number expected content bytes of the downloading file.
@property (nonatomic, assign, readonly) long long expectedContentLength
Discussion
If the headers did not specify a content length to expect then this value is -1
Declared In
DTDownload.h
Class Methods
downloadForURL:atPath:
Creates a download for a given URL at the given path If a previous uncompleted download at the destination location exists then the download is tried to resumed, otherwise a new full download is performed.
+ (DTDownload *)downloadForURL:(NSURL *)URL atPath:(NSString *)path
Return Value
a new DTDownload instance
Declared In
DTDownload.h
Instance Methods
canResume
YES if the download can be resumed, otherwise no
- (BOOL)canResume
Return Value
YES if the download can be resumed, otherwise no
Declared In
DTDownload.h
cleanup
Removes the downloaded file or the incomplete file if the download is currently running. Note: Also the download is cancelled if necessary
- (void)cleanup
Declared In
DTDownload.h
initWithURL:
Creates a download for a given URL.
- (id)initWithURL:(NSURL *)url
Parameters
- url
A remote URL
Return Value
An initialized download object
Declared In
DTDownload.h
initWithURL:withDestinationFile:
Creates a download for a given URL and stores the result to the file
- (id)initWithURL:(NSURL *)url withDestinationFile:(NSString *)destinationFile
Return Value
An initialized download object
Declared In
DTDownload.h
initWithURL:withDestinationPath:
Creates a download for a given URL and stores the result to the destination path with the filename that provided by the webserver. The the webserver does provide a filename then the last path component of the URL is used.
- (id)initWithURL:(NSURL *)url withDestinationPath:(NSString *)destinationPath
Return Value
An initialized download object
Declared In
DTDownload.h
isRunning
Determines if the download is currently in progress
- (BOOL)isRunning
Declared In
DTDownload.h
startHEAD
Starts a HEAD request for the given URL. This retrieves the headers and not the body of the document.
- (void)startHEAD
Declared In
DTDownload.h