Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new method like JsonParser.readText(Writer) (and implementation) for truly non-buffering reads #1288

Open
cowtowncoder opened this issue May 6, 2024 · 0 comments
Labels
performance Issue related to performance problems or enhancements

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented May 6, 2024

(note: off-shoot of FasterXML/jackson#221)
(note: was earlier filed as #15, mea culpa)

Currently there is no way to access contents of long JSON String values without buffering of all contents in memory: even metho

JsonParser.getText(Writer)

will temporarily buffer contents in TextBuffer (but avoids construction of big String unlike getText()).
But it would be possible and desirable to have an alternative that would decode and provide content without buffering; similar to how Stax2-compliant XML parsers (Aalto, Woodstox) do it.

Semantic difference would be that such method, f.ex

JsonParser.readText(Writer)

would read, pass and consume contents, such that after call finishes, parser now points to the end of text value, and text value could no longer be read.
Because of this change, we cannot change implementation of existing getText(Writer)

I will also update Javadocs of getText(Writer) to indicate use of buffering.

@cowtowncoder cowtowncoder added the performance Issue related to performance problems or enhancements label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Issue related to performance problems or enhancements
Projects
None yet
Development

No branches or pull requests

1 participant