UNICORN - iOS
実体メソッド | 限定公開変数類 | プロパティ | 全メンバ一覧
SBJsonStreamWriter クラス

The Stream Writer class. [詳解]

#import <SBJsonStreamWriter.h>

SBJsonStreamWriter の継承関係図

実体メソッド

(BOOL) - writeObject:
 
(BOOL) - writeArray:
 
(BOOL) - writeObjectOpen
 
(BOOL) - writeObjectClose
 
(BOOL) - writeArrayOpen
 
(BOOL) - writeArrayClose
 
(BOOL) - writeNull
 
(BOOL) - writeBool:
 
(BOOL) - writeNumber:
 
(BOOL) - writeString:
 
(BOOL) - writeValue:
 
(void) - appendBytes:length:
 

限定公開変数類

NSMutableDictionary * cache
 

プロパティ

SBJsonStreamWriterStatestate
 
NSMutableArray * stateStack
 
id< SBJsonStreamWriterDelegatedelegate
 delegate to receive JSON output Delegate that will receive messages with output.
 
NSUInteger maxDepth
 The maximum recursing depth. [詳解]
 
BOOL humanReadable
 Whether we are generating human-readable (multiline) JSON. [詳解]
 
BOOL sortKeys
 Whether or not to sort the dictionary keys in the output. [詳解]
 
NSComparator sortKeysComparator
 An optional comparator to be used if sortKeys is YES. [詳解]
 
NSString * error
 Contains the error description after an error has occured.
 

詳解

The Stream Writer class.

Accepts a stream of messages and writes JSON of these to its delegate object.

This class provides a range of high-, mid- and low-level methods. You can mix and match calls to these. For example, you may want to call -writeArrayOpen to start an array and then repeatedly call -writeObject: with various objects before finishing off with a -writeArrayClose call.

参照
JSON to Objective-C

メソッド詳解

- (BOOL) writeArray: (NSArray *)  array

Write an NSArray to the JSON stream.

戻り値
YES if successful, or NO on failure
- (BOOL) writeArrayClose

Close the current Array being written

戻り値
YES if successful, or NO on failure
- (BOOL) writeArrayOpen

Start writing an Array to the stream

戻り値
YES if successful, or NO on failure
- (BOOL) writeBool: (BOOL)  x

Write a boolean to the stream

戻り値
YES if successful, or NO on failure
- (BOOL) writeNull

Write a null to the stream

戻り値
YES if successful, or NO on failure
- (BOOL) writeNumber: (NSNumber*)  n

Write a Number to the stream

戻り値
YES if successful, or NO on failure
- (BOOL) writeObject: (NSDictionary*)  dict

Write an NSDictionary to the JSON stream.

戻り値
YES if successful, or NO on failure
- (BOOL) writeObjectClose

Close the current object being written

戻り値
YES if successful, or NO on failure
- (BOOL) writeObjectOpen

Start writing an Object to the stream

戻り値
YES if successful, or NO on failure
- (BOOL) writeString: (NSString*)  s

Write a String to the stream

戻り値
YES if successful, or NO on failure

プロパティ詳解

- (BOOL) humanReadable
readwriteatomic

Whether we are generating human-readable (multiline) JSON.

Set whether or not to generate human-readable JSON. The default is NO, which produces JSON without any whitespace between tokens. If set to YES, generates human-readable JSON with linebreaks after each array value and dictionary key/value pair, indented two spaces per nesting level.

- (NSUInteger) maxDepth
readwriteatomic

The maximum recursing depth.

Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0.

- (BOOL) sortKeys
readwriteatomic

Whether or not to sort the dictionary keys in the output.

If this is set to YES, the dictionary keys in the JSON output will be in sorted order. (This is useful if you need to compare two structures, for example.) The default is NO.

- (NSComparator) sortKeysComparator
readwriteatomiccopy

An optional comparator to be used if sortKeys is YES.

If this is nil, sorting will be done via (compare:).


このクラス詳解は次のファイルから抽出されました: