jsonp-api icon indicating copy to clipboard operation
jsonp-api copied to clipboard

Enable to skip content reading/materialization

Open rmannibucau opened this issue 6 years ago • 5 comments

Follow up of https://github.com/eclipse-ee4j/jsonb-api/issues/224#issuecomment-590126204

Would be neat to have a way to skip some elements so instead of materializing it. Concretely it means next will need a skip equivalent, visiting the stream but ignoring the content. GetXxx would fail if called after a skip.

rmannibucau avatar Feb 24 '20 06:02 rmannibucau

There is nothing in the JSON-P API that prevents an implementation from lazily fetching entries, is there? My understanding is that the call to next() advances the stream and subsequent getXXX() call are used to to fetch entries. An implementation should be free to optimize away any materialization of intermediate entries if getXXX() is never called.

emattheis avatar Feb 24 '20 15:02 emattheis

This is my understanding as well. There is also JsonParser#skipObject() and skipArray() which can be used to avoid even having to manifest the skipped events.

jjspiegel avatar Feb 24 '20 16:02 jjspiegel

There is nothing in the JSON-P API that prevents an implementation from lazily fetching entries, is there?

There is nothing which enforces it so assume it is not the case (spec world).

rmannibucau avatar Feb 24 '20 16:02 rmannibucau

Does JSON-P even have a published spec? All I can find is the API.

emattheis avatar Feb 24 '20 16:02 emattheis

There is no spec document for JSON-P. The Javadocs/TCK constitute the spec.

alexsm82 avatar Feb 24 '20 19:02 alexsm82