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
-
URLproperty -
downloadEntityTagproperty -
contentTypeproperty -
expectedContentLengthproperty -
lastModifiedDateproperty -
contextproperty -
additionalHTTPHeadersproperty -
delegateproperty
Initializing a Download Object
-
– initWithURL: -
– initWithURL:withDestinationPath: -
– initWithURL:withDestinationFile: -
+ downloadForURL:atPath:
Starting the Download
Block Handlers
-
responseHandlerproperty -
completionHandlerproperty
Properties
URL
Returns the URL that is being downloaded by the receiver.
@property (nonatomic, strong, readonly) NSURL *URLDeclared In
DTDownload.hadditionalHTTPHeaders
Using for HTTP headers parameters. For example, basic http authentification
@property (nonatomic, copy) NSDictionary *additionalHTTPHeadersSee Also
Declared In
DTDownload.hcompletionHandler
Sets the block to execute as soon as the download has completed.
@property (nonatomic, copy) DTDownloadCompletionHandler completionHandlerDeclared In
DTDownload.hcontentType
Returns the MIME type of the downloading file.
@property (nonatomic, strong, readonly) NSString *contentTypeDeclared In
DTDownload.hcontext
Use to set or retrieve an object that provides a context for the download.
@property (nonatomic, strong) id contextDeclared In
DTDownload.hdelegate
Returns the receiver’s delegate.
@property (nonatomic, assign) id<DTDownloadDelegate> delegateSee Also
Declared In
DTDownload.hdownloadEntityTag
Returns the entity tag of the downloading file.
@property (nonatomic, strong, readonly) NSString *downloadEntityTagDeclared In
DTDownload.hexpectedContentLength
Returns the number expected content bytes of the downloading file.
@property (nonatomic, assign, readonly) long long expectedContentLengthDiscussion
If the headers did not specify a content length to expect then this value is -1
Declared In
DTDownload.hClass 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 *)pathReturn Value
a new DTDownload instance
Declared In
DTDownload.hInstance Methods
canResume
YES if the download can be resumed, otherwise no
- (BOOL)canResumeReturn Value
YES if the download can be resumed, otherwise no
Declared In
DTDownload.hcleanup
Removes the downloaded file or the incomplete file if the download is currently running. Note: Also the download is cancelled if necessary
- (void)cleanupDeclared In
DTDownload.hinitWithURL:
Creates a download for a given URL.
- (id)initWithURL:(NSURL *)urlParameters
- url
A remote URL
Return Value
An initialized download object
Declared In
DTDownload.hinitWithURL:withDestinationFile:
Creates a download for a given URL and stores the result to the file
- (id)initWithURL:(NSURL *)url withDestinationFile:(NSString *)destinationFileReturn Value
An initialized download object
Declared In
DTDownload.hinitWithURL: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 *)destinationPathReturn Value
An initialized download object
Declared In
DTDownload.hisRunning
Determines if the download is currently in progress
- (BOOL)isRunningDeclared In
DTDownload.hstartHEAD
Starts a HEAD request for the given URL. This retrieves the headers and not the body of the document.
- (void)startHEADDeclared In
DTDownload.h