• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing 8-bit bytes from a file using Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Accessing 8-bit bytes from a file using Cocoa (From: Phil Faber <email@hidden>)
 >Re: Accessing 8-bit bytes from a file using Cocoa (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Versioning and CoreData
  • Next by Date: Core Data Speed (XML vs mySQL)
  • Previous by thread: Re: Accessing 8-bit bytes from a file using Cocoa
  • Next by thread: Can't get System prefPane to work
  • Index(es):
    • Date
    • Thread