XGFileDownload

Inherits from:
Declared In:

Overview

A XGFileDownload downloads the content of an XGFile. The content may be downloaded to a file on disk, to memory, or both. The content and progress of the download is reported via the XGFileDownloadDelegate protocol.



Methods

-cancel

Cancels the download and deletes the partially downloaded file, if any.

-delegate

Returns the delegate of the download.

-destination

Returns the destionation of the download, or nil if no destination has been set.

-file

Returns the file of the download.

-initWithFile:delegate:

Initializes a XGFileDownload object and starts the download.

-setDestination:allowOverwrite:

Sets the destination path of the downloaded file.


cancel


Cancels the download and deletes the partially downloaded file, if any.

- (void)cancel; 


delegate


Returns the delegate of the download.

- (id)delegate; 
Return Value

The delegate of the download.


destination


Returns the destionation of the download, or nil if no destination has been set.

- (NSString *)destination; 
Return Value

The destination of the download.


file


Returns the file of the download.

- (XGFile *)file; 
Return Value

The file of the download.


initWithFile:delegate:


Initializes a XGFileDownload object and starts the download.

- (id)initWithFile:(XGFile *)file delegate:(id)delegate; 
Parameters
file

The file to download. Must not be nil.

delegate

The delegate of the download.

Return Value

An initialized XGFileDownload object.


setDestination:allowOverwrite:


Sets the destination path of the downloaded file.

- (void)setDestination:(NSString *)destination 
        allowOverwrite:(BOOL)allowOverwrite; 
Parameters
path

The destination path of the downloaded file.

allowOverwrite

Allows a file of the same path to be overwritten.

Discussion

This method can be called after the download is created or in response to the decideDestinationWithSuggestedFilename: delegate method. It should only be called once. If NO is passed for allowOverwrite and a file of the same path exists, a number will be appended to the filename to prevent the overwrite. Because of this, use the path passed with didCreateDestination: to determine the actual path of the downloaded file.

Did this document help you? Yes It's good, but... Not helpful...

 

Last Updated: 2009-08-12