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

Creates NDJSON output as a string. More...

#include <NdjsonWriter.qc.dox.h>

Inheritance diagram for NdjsonDataProvider::NdjsonStringWriter:
NdjsonDataProvider::NdjsonWriter

Public Member Methods

void constructor (soft< hash< NdjsonWriterOptions > > options)
 Creates the string writer.
 
string getString ()
 Returns the NDJSON string.
 
void clear ()
 Clears the internal buffer and resets the writer.
 
- Public Member Methods inherited from NdjsonDataProvider::NdjsonWriter
void constructor (Qore::OutputStream output_stream, soft< hash< NdjsonWriterOptions > > options)
 Creates the writer with an output stream.
 
int write (auto value)
 Writes a JSON value as a line.
 
int writeAll (list< auto > values)
 Writes multiple JSON values as lines.
 
int getRecordsWritten ()
 Returns the number of records written.
 

Private Attributes

StringOutputStream sos
 The string output stream.
 
- Private Attributes inherited from NdjsonDataProvider::NdjsonWriter
Qore::StreamWriter writer
 The output stream.
 
string line_ending
 Line ending string.
 
hash< NdjsonWriterOptionsopts
 Writer options.
 

Detailed Description

Creates NDJSON output as a string.

This is a convenience class that writes NDJSON to an internal string buffer.

Example
NdjsonStringWriter writer();
writer.write({"id": 1});
writer.write({"id": 2});
string result = writer.getString();

Member Function Documentation

◆ constructor()

void NdjsonDataProvider::NdjsonStringWriter::constructor ( soft< hash< NdjsonWriterOptions > >  options)

Creates the string writer.

Parameters
optionswriter options

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