Wrap NSFileHandle or Subclass NSInputStream?
Wrap NSFileHandle or Subclass NSInputStream?
- Subject: Wrap NSFileHandle or Subclass NSInputStream?
- From: Duncan Anker <email@hidden>
- Date: Mon, 08 May 2006 12:15:25 +1000
Hi List,
I am playing around with the concept of override files - that is, using
a file if it exists or using an NSData object if it does not.
My initial thought was to wrap an NSFileHandle in one class and NSData
in another, implementing a class cluster to present a common API. I then
discovered that NSInputStream offers the functionality to use either a
file or data which seems to be pretty close to what I want. The only
thing is would need random access to the stream and abilities to e.g.
calculate the length, so it seems I would need to subclass NSInputStream
and implement the functionality already provided by NSFileHandle.
So which is the better approach? Wrap NSFileHandle and NSData, then
implement "file" position and seeking methods on the data object, and
have it all hide in a class cluster, or subclass NSInputStream and
reimplement most of what NSFileHandle already gives me except extended
to cope with NSData as well?
Adv thanks ance
Duncan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden