1 -(
void) testJsonWithStream
2 {
3 NSString *path = [[NSBundle mainBundle] pathForResource:
@"
Notes
" ofType:
@"
json
"];
//
获取文件的NSString路径
4
5 NSInputStream *inputStream = [[NSInputStream alloc] initWithFileAtPath:path];
//
创建Stream对象
6
[inputStream open];
//
打开Stream对象
7
8 id jsonObj = [NSJSONSerialization JSONObjectWithStream:inputStream options:NSJSONReadingMutableLeaves error:nil];
9
10 NSInteger id = [jsonObj objectForKey:
@"
ResultCode
"];
11 NSLog(
@"
%@
",[jsonObj objectForKey:
@"
ResultCode
"]);
12
13
//
创建输出流
14
NSOutputStream *outpuStream =&nb