Reading a line at a time with NSData?

2009-01-06 Thread James Cicenia
I have an NSData object. I am using the sample AJAXFileUpload which gives me an NSData object. I am reading in a tab delimited text file and was wondering how do I read line per line. Thanks James Cicenia ___ Do not post admin requests to the list.

Re: Reading a line at a time with NSData?

2009-01-06 Thread Timo Hoepfner
Hi, try something like this: NSData data = ...; // your existing NSData object try { BufferedReader reader = new BufferedReader(new InputStreamReader (data.stream())); try { while (reader.ready()) { String line = reader.readLine();

Re: Reading a line at a time with NSData?

2009-01-06 Thread Kieran Kelleher
Use a java.io.BufferReader.readLine() On Jan 5, 2009, at 2:56 PM, James Cicenia wrote: I have an NSData object. I am using the sample AJAXFileUpload which gives me an NSData object. I am reading in a tab delimited text file and was wondering how do I read line per line. Thanks James Cicenia

Re: Reading a line at a time with NSData?

2009-01-06 Thread Hugi Thordarson
I'm lazy so I would usually do something like this: NSData yourNSData = whateverYourDataIs(); String encoding = whatEverYourEncodingIs(); try { String text = new String( yourNSData.bytes(), encoding ); NSArrayString lines =