Hi Tima,
I know this may not be "pure" OpenStep, but did you check Apple's
"Stream Programming Guide for Cocoa" at
http://developer.apple.com/documentation/Cocoa/Conceptual/Streams/
index.html?http://developer.apple.com/documentation/Cocoa/Conceptual/
Streams/Articles/CocoaStreamsOverview.html
I think you can read bytes from the stream using the NSInputStream
subclass,
the - (BOOL)getBuffer:(uint8_t **)buffer length:(unsigned int *)len
and - (int)read:(uint8_t *)buffer maxLength:(unsigned int)len
methods seem quite interesting.
If I had to read a stream then I'd go this way, but this is a
personal opinion.
Renaud.
On Jan 21, 2007, at 11:28 PM, Tima wrote:
Hi list,
I'm going to write a serializer/decerialiser pair of procedures for
a data
description format (more specifically, for JSON, see http://
json.org and http://json-rpc.org ).
BJSONAdditions (http://blakeseely.com/blog/archives/2006/03/29/
bsjsonadditions-12/,
the lates version is actually 1.3 at http://blakeseely.com/source/
BJSONAdditions.zip )
suggests
@interface NSDictionary (BSJSONAdditions)
+ (NSDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
- (NSString *)jsonStringValue;
@end
One thing I do not understand is: is it the best to read from
NSString?
Most of the time JSON will be read from stream socket, sometimes
from file,
therefore I was seeking for some universal object that provides per-
character read
access without requiring any knowledge of the media.
In C++ there are input and output streams (<iostream>) that are
widely used for
I/O when a programmer wants to detach the API from a particular media.
I was reading about NSStream and its subclasses and got confused. I
realized I can get
them for socket, file or memory buffer, but I did not realize how
to use them for
per-character input or output.
What is the recommended way to do buffered I/O in NextStep?
Thanks a lot,
Tima
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep
----------------------------------------------------------------------
-----------------
Orange vous informe que cet e-mail a ete controle par l'anti-virus
mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep