Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5.2
-
Fix Version/s: 1.6
-
Component/s: JsonParser
-
Labels:None
Description
Jackson JsonParser buffers its input extensively, since this is beneficial for performance. But once read into buffers, there is no way to "push back" content that is not parsed. Being able to do that would be very useful for cases where JSON content is interleaved with other content.
Since there are two kinds of input sources (byte-based like InputStream, character-based like Reader), there need to be two methods, for example:
JsonParser.releaseBufferedInput(OutputStream);
JsonParser.releaseBufferedInput(Writer);
when called for appropriate type, all currently buffered but unused content should be written using given argument.
Additional idea: check whether underlying input comes via PushbackReader or PushbackInputStream; and if so, push unused content back automatically.
Given that this might cause unexpected behavior change, this should only be done if enabled by a new JsonParser.Feature.