[Previous] [Class List] [Next]
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
+ (Class)URLHandleClassForURL:(NSURL *)anURL
Returns the class of the URL
handle used for anURL. Subclasses
of NSURLHandle must be registered via the registerURLHandleClass: method.
+ (NSURLHandle *)cachedHandleForURL:(NSURL *)anURL
Returns the URL handle from
the cache that contains cached resource data for the URL anURL.
+ (BOOL)canInitWithURL:(NSURL *)anURL
Returns whether an URL handle
can be initialized with anURL. If anURL uses
an unsupported scheme, this method returns NO
.
+ (void)registerURLHandleClass:(Class)anURLHandleSubclass
Registers anURLHandleSubclass
as an available subclass of NSURLHandle.
Instance Methods
- (void)addClient:(id <NSURLHandleClient>)client
Adds client (an
object conforming to the NSURLHandleClient protocol) as a client
of the URL handle.
- (NSData *)availableResourceData
Returns the currently available
resource data managed by the URL handle.
- (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.
- (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.
- (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.
- (void)didLoadBytes:(NSData *)newBytes loadComplete:(BOOL)yorn
<<Description forthcoming.>>
- (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.
- (NSString *)failureReason
Returns a string describing
the reason a load failed.
- (void)flushCachedData
Flushes any cached data for
URL's served by this URL handle.
- 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.
- (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.
- (NSData *)loadInForeground
Loads the URL handle's data
in the foreground.
- (id)propertyForKey:(NSString *)propertyKey
Returns the property for key propertyKey.
- (id)propertyForKeyIfAvailable:(NSString *)propertyKey
Returns the property for key propertyKey.
- (void)removeClient:(id <NSURLHandleClient>)client
Removes client as
an NSURLHandleClient of the URL handle.
- (NSData *)resourceData
Returns the resource data managed
by the URL handle, loading it if necessary. Blocks
until all data is available.
- (NSURLHandleStatus)status
Returns the status of the URL
handle.
- (BOOL)writeData:(NSData *)data
<<Description forthcoming.>>
- (BOOL)writeProperty:(id)propertyValue forKey:(NSString
*)propertyKey
<<Description forthcoming.>>
[Previous] [Next]