simdjson
3.11.0
Ridiculously Fast JSON
|
A forward-only stream of documents. More...
Classes | |
class | iterator |
An iterator through a forward-only stream of documents. More... | |
Public Member Functions | |
simdjson_inline | document_stream () noexcept |
Construct an uninitialized document_stream. More... | |
simdjson_inline | document_stream (document_stream &&other) noexcept=default |
Move one document_stream to another. | |
simdjson_inline document_stream & | operator= (document_stream &&other) noexcept=default |
Move one document_stream to another. | |
size_t | size_in_bytes () const noexcept |
Returns the input size in bytes. | |
size_t | truncated_bytes () const noexcept |
After iterating through the stream, this method returns the number of bytes that were not parsed at the end of the stream. More... | |
simdjson_inline iterator | begin () noexcept |
Start iterating the documents in the stream. | |
simdjson_inline iterator | end () noexcept |
The end of the stream, for iterator comparison purposes. | |
A forward-only stream of documents.
Produced by parser::parse_many.
Definition at line 72 of file document_stream.h.
|
noexcept |
Construct an uninitialized document_stream.
Definition at line 110 of file document_stream-inl.h.
|
inlinenoexcept |
After iterating through the stream, this method returns the number of bytes that were not parsed at the end of the stream.
If truncated_bytes() differs from zero, then the input was truncated maybe because incomplete JSON documents were found at the end of the stream. You may need to process the bytes in the interval [size_in_bytes()-truncated_bytes(), size_in_bytes()).
You should only call truncated_bytes() after streaming through all documents, like so:
document_stream stream = parser.parse_many(json,window); for(auto doc : stream) { // do something with doc } size_t truncated = stream.truncated_bytes();
Definition at line 266 of file document_stream-inl.h.