Qore json Module 1.11.0
Loading...
Searching...
No Matches
NdjsonDataProvider::InputStreamNdjsonIterator Class Reference

Iterator for reading NDJSON data from an input stream. More...

#include <NdjsonIterator.qc.dox.h>

Inherits AbstractIterator.

Public Member Methods

void constructor (Qore::InputStream input_stream, soft< hash< NdjsonIteratorOptions > > options)
 Creates the iterator from an input stream.
 
auto getValue ()
 Returns the current JSON value.
 
bool valid ()
 Returns True if the iterator is valid.
 
int getLineNumber ()
 Returns the current line number (1-based)
 

Private Attributes

Qore::StreamReader reader
 The input stream.
 
auto current_value
 Current parsed value.
 
hash< NdjsonIteratorOptionsopts
 Options for the iterator.
 

Detailed Description

Iterator for reading NDJSON data from an input stream.

This class provides an iterator interface for reading NDJSON formatted data from an input stream, enabling memory-efficient processing of large files.

Example
FileInputStream fis("data.ndjson");
InputStreamNdjsonIterator iter(fis);
while (iter.next()) {
printf("Value: %y\n", iter.getValue());
}

Member Function Documentation

◆ constructor()

void NdjsonDataProvider::InputStreamNdjsonIterator::constructor ( Qore::InputStream  input_stream,
soft< hash< NdjsonIteratorOptions > >  options 
)

Creates the iterator from an input stream.

Parameters
input_streamthe input stream to read from
optionsiterator options

◆ getValue()

auto NdjsonDataProvider::InputStreamNdjsonIterator::getValue ( )

Returns the current JSON value.

Returns
the parsed JSON value
Exceptions
ITERATOR-ERRORif the iterator is not valid

The documentation for this class was generated from the following file: