FasterXML/jackson-core

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

cowtowncoder opened this issue · 0 comments

(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.