3

I am porting a java client to the iphone and i have been wondering if there is a wrapper around NSInputStream to read strings from a stream stopping at a specified delimiter? I am thinking of something like Javas Scanner class (http://download.oracle.com/javase/6/docs/api/index.html?overview-summary.html).

I need this functionality because my iphone client is recieving messages from the server where the end of a message is defined by the chars CR and LF

I have been searching google and stackoverflow without any luck. Just asking to make sure i dont start re-inventing the wheel so to speak.

Thanks for any help! :=)

EmptyStack
  • 51,274
  • 23
  • 147
  • 178
Emil Sjölander
  • 1,773
  • 4
  • 19
  • 27

1 Answers1

1

I don't think that's possible. Maybe you could read the stream to a buffer, convert to NSString and search for your delimiters. NSInputStream allows you to read chunks of N bytes but you have to convert it to an NSString on your own and then work on your logic with the delimiters.