• 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: Read lines from very large text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read lines from very large text file


  • Subject: Re: Read lines from very large text file
  • From: Kenneth Bruno II <email@hidden>
  • Date: Mon, 2 Feb 2009 21:56:41 -0500

On Feb 2, 2009, at 9:29 PM, Peter Duniho wrote:

On Feb 2, 2009, at 6:02 PM, Seth Willits wrote:

Before opening the file, either determine, guess, or be told what the encoding is. With that encoding, convert your delimiter string into raw bytes, then do byte-for-byte comparison on the file to find occurrences of that delimiter.

Is there not a Cocoa class that handles character encoding and line- based reading from files, streams, etc.? And an equivalent one for writing?


That seems like an odd omission for a comprehensive framework.

NSString handles such things, the only thing I'm not sure is how it will handle a truly large multi-gigabyte text file (not that anyone is likely to have such a beast). With a gigantic file like that you'd probably have to switch to using something like NSFileHandle, read chunks, and then parse those chunks. However, I'd expect NSString to be handle reasonably large files in a sane manner.


As far as string manipulation, I'd take a look at the information straight from the horse's mouth:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/introStrings.html >


There are sections dedicated to reading strings from files and paragraphs and line breaks.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Read lines from very large text file
      • From: Peter Duniho <email@hidden>
References: 
 >Read lines from very large text file (From: Jacob Rhoden <email@hidden>)
 >Re: Read lines from very large text file (From: Alexander Spohr <email@hidden>)
 >Re: Read lines from very large text file (From: Jacob Rhoden <email@hidden>)
 >Re: Read lines from very large text file (From: Robert Martin <email@hidden>)
 >Re: Read lines from very large text file (From: Seth Willits <email@hidden>)
 >Re: Read lines from very large text file (From: Joar Wingfors <email@hidden>)
 >Re: Read lines from very large text file (From: Seth Willits <email@hidden>)
 >Re: Read lines from very large text file (From: Peter Duniho <email@hidden>)

  • Prev by Date: Re: Thai Dictionary
  • Next by Date: Re: Read lines from very large text file
  • Previous by thread: Re: Read lines from very large text file
  • Next by thread: Re: Read lines from very large text file
  • Index(es):
    • Date
    • Thread