Developer Documentation
PATH  Mac OS X Documentation > Foundation Reference: Objective-C


[Previous] [Class List] [Next]

NSURLHandle


Inherits from: NSObject
Conforms to: none
Declared in: Foundation/NSURLHandle.h




Class Description


NSURLHandle is the class responsible for managing resource data accessed by an NSURL object. A single NSURLHandle can service multiple equivalent NSURL objects. If you want to implement support for additional URL schemes, you would do so by creating a subclass of NSURLHandle.


Class Methods



URLHandleClassForURL:

+ (Class)URLHandleClassForURL:(NSURL *)anURL

Returns the class of the URL handle used for anURL. Subclasses of NSURLHandle must be registered via the registerURLHandleClass: method.

cachedHandleForURL:

+ (NSURLHandle *)cachedHandleForURL:(NSURL *)anURL

Returns the URL handle from the cache that contains cached resource data for the URL anURL.

canInitWithURL:

+ (BOOL)canInitWithURL:(NSURL *)anURL

Returns whether an URL handle can be initialized with anURL. If anURL uses an unsupported scheme, this method returns NO.

registerURLHandleClass:

+ (void)registerURLHandleClass:(Class)anURLHandleSubclass

Registers anURLHandleSubclass as an available subclass of NSURLHandle.


Instance Methods



addClient:

- (void)addClient:(id <NSURLHandleClient>)client

Adds client (an object conforming to the NSURLHandleClient protocol) as a client of the URL handle.

availableResourceData

- (NSData *)availableResourceData

Returns the currently available resource data managed by the URL handle.

backgroundLoadDidFailWithReason:

- (void)backgroundLoadDidFailWithReason:(NSString *)reason

Called when a background load fails. This method is provided mainly for subclasses that wish to take some action before passing along the failure notification to the URL client. You should call super's implementation at the end of your implementation of this method.

beginLoadInBackground

- (void)beginLoadInBackground

Called when a background load begins. This method is provided mainly for subclasses that wish to take some action before notifying the URL client that a background load has begun. You should call super's implementation at the end of your implementation of this method.

cancelLoadInBackground

- (void)cancelLoadInBackground

Called when a background load is cancelled. This method is provided mainly for subclasses that wish to take some action before passing along the cancel notification to the URL client. You should call super's implementation at the end of your implementation of this method.

didLoadBytes:loadComplete:

- (void)didLoadBytes:(NSData *)newBytes loadComplete:(BOOL)yorn

<<Description forthcoming.>>

endLoadInBackground

- (void)endLoadInBackground

Called when a background load ends. This method is provided mainly for subclasses that wish to take some action before notifying the URL client that a background load has finished. You should call super's implementation at the end of your implementation of this method.

failureReason

- (NSString *)failureReason

Returns a string describing the reason a load failed.

flushCachedData

- (void)flushCachedData

Flushes any cached data for URL's served by this URL handle.

initWithURL:cached:

- initWithURL:(NSURL *)anURL cached:(BOOL)willCache

Initializes a newly created URL handle with the URL anURL. willCache controls whether the URL handle will cache its data and respond to requests from equivalent URL's for the cached data.

loadInBackground

- (void)loadInBackground

Loads the URL handle's data in the background. Only one thread is maintained for background loading, so only one background loading operation can be in progress at a time. If multiple background loads are requested, the later requests will wait in a queue until earlier requests are handled.

loadInForeground

- (NSData *)loadInForeground

Loads the URL handle's data in the foreground.

propertyForKey:

- (id)propertyForKey:(NSString *)propertyKey

Returns the property for key propertyKey.

propertyForKeyIfAvailable:

- (id)propertyForKeyIfAvailable:(NSString *)propertyKey

Returns the property for key propertyKey.

removeClient:

- (void)removeClient:(id <NSURLHandleClient>)client

Removes client as an NSURLHandleClient of the URL handle.

resourceData

- (NSData *)resourceData

Returns the resource data managed by the URL handle, loading it if necessary. Blocks until all data is available.

status

- (NSURLHandleStatus)status

Returns the status of the URL handle.

writeData:

- (BOOL)writeData:(NSData *)data

<<Description forthcoming.>>

writeProperty:forKey:

- (BOOL)writeProperty:(id)propertyValue forKey:(NSString *)propertyKey

<<Description forthcoming.>>


[Previous] [Next]