All Bundles
StreamParser
Event driven stream JSON parser
Operations
Code example:
stream := FileReader->New(filename);
if(stream->IsOpen()) {
parser := StreamParser->New(stream);
found := false;
do {
if(parser->FindElement("Value", 4)) {
parser->Next();
if(parser->GetTypeValue()->Equals("{d4db6850-5385-11d0-89e9-00a0c90a90ac}")) {
found := true;
};
};
}
while(<>found & parser->Next());
parser->GetTypeValue()->PrintLine();
};
stream->Close();
New
Constructor
New(input:InputStream)
Parameters
Name | Type | Description |
---|
input | InputStream | input stream |
AtLevel
Checks the current parse level
method : public : AtLevel(level:Int) ~ Bool
Parameters
Name | Type | Description |
---|
level | Int | parse level |
Return
Type | Description |
---|
Bool | current parse level |
FindElement
Find element by name
method : public : FindElement(name:String) ~ Bool
Parameters
Name | Type | Description |
---|
name | String | element by name |
Return
Type | Description |
---|
Bool | true if found, false otherwise |
Find element by name
method : public : FindElement(name:String, level:Int) ~ Bool
Parameters
Name | Type | Description |
---|
name | String | element by name |
level | Int | element level |
Return
Type | Description |
---|
Bool | true if found, false otherwise |
Find element by type
method : public : FindElement(type:StreamParser->Type) ~ Bool
Parameters
Name | Type | Description |
---|
type | StreamParser->Type | element by type |
Return
Type | Description |
---|
Bool | true if found, false otherwise |
Find element by type
method : public : FindElement(type:StreamParser->Type, level:Int) ~ Bool
Parameters
Name | Type | Description |
---|
type | StreamParser->Type | element by type |
level | Int | element level |
Return
Type | Description |
---|
Bool | true if found, false otherwise |
GetLevel
Get JSON parse level. Level increase as objects and arrays are parsed.
method : public : GetLevel() ~ Int
Return
Type | Description |
---|
Int | JSON parse level |
GetType
Get JSON type
method : public : GetType() ~ StreamParser->Type
Return
Type | Description |
---|
StreamParser->Type | JSON type |
GetTypeName
Get JSON type name
method : public : GetTypeName() ~ String
Return
Type | Description |
---|
String | JSON type name |
GetTypeValue
Get JSON values
method : public : GetTypeValue() ~ String
Return
Type | Description |
---|
String | JSON value if it exists, blank string otherwise |
Next
Checks for the next JSON token
method : public : Next() ~ Bool
Return
Type | Description |
---|
Bool | true if next token exists, false otherwise |