Re: Accessing 8-bit bytes from a file using Cocoa
Re: Accessing 8-bit bytes from a file using Cocoa
- Subject: Re: Accessing 8-bit bytes from a file using Cocoa
- From: Ondra Cada <email@hidden>
- Date: Mon, 1 May 2006 21:29:02 +0200
Sherm,
On 1.5.2006, at 21:07, Sherm Pendley wrote:
On May 1, 2006, at 8:17 AM, Phil Faber wrote:
The file could be any size.
Therefore,
I often use NSData's +dataWithContentsOfMappedFile: to memory-map a
file. Then I can simply call the returned instance's -bytes method
to get a pointer to the data, and let the VM subsystem handle
reading & writing pages as needed.
although very convenient, this approach won't work. Due to the addres
space size, it can be reliably used up to a gigabyte or so only. For
bigger files (as I've written already I think twice in this very
thread :)) NSFileHandle is needed. Or mmap, which allows to map only
a part of the file (and is not "pure Cocoa", which is not problem
generally, but may render the source slighlty less readable, at least
for a beginner).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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