v2025.6.2
All Bundles

StreamParser

Event driven stream JSON parser

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();

Operations

AtLevel

Checks the current parse level

method : public : AtLevel(level:Int) ~ Bool

Parameters

NameTypeDescription
levelIntparse level

Return

TypeDescription
Boolcurrent parse level

FindElement

Find element by name

method : public : FindElement(name:String) ~ Bool

Parameters

NameTypeDescription
nameStringelement by name

Return

TypeDescription
Booltrue if found, false otherwise

FindElement

Find element by name

method : public : FindElement(name:String, level:Int) ~ Bool

Parameters

NameTypeDescription
nameStringelement by name
levelIntelement level

Return

TypeDescription
Booltrue if found, false otherwise

FindElement

Find element by type

method : public : FindElement(type:StreamParser->Type) ~ Bool

Parameters

NameTypeDescription
typeStreamParser->Typeelement by type

Return

TypeDescription
Booltrue if found, false otherwise

FindElement

Find element by type

method : public : FindElement(type:StreamParser->Type, level:Int) ~ Bool

Parameters

NameTypeDescription
typeStreamParser->Typeelement by type
levelIntelement level

Return

TypeDescription
Booltrue if found, false otherwise

GetLevel

Get JSON parse level. Level increase as objects and arrays are parsed.

method : public : GetLevel() ~ Int

Return

TypeDescription
IntJSON parse level

GetType

Get JSON type

method : public : GetType() ~ StreamParser->Type

Return

TypeDescription
StreamParser->TypeJSON type

GetTypeName

Get JSON type name

method : public : GetTypeName() ~ String

Return

TypeDescription
StringJSON type name

GetTypeValue

Get JSON values

method : public : GetTypeValue() ~ String

Return

TypeDescription
StringJSON value if it exists, blank string otherwise

New

Constructor

New(input:InputStream)

Parameters

NameTypeDescription
inputInputStreaminput stream

Next

Checks for the next JSON token

method : public : Next() ~ Bool

Return

TypeDescription
Booltrue if next token exists, false otherwise