wanglingsong / JsonSurfer

A streaming JsonPath processor in Java
MIT License
292 stars 55 forks source link

Support for feeding via bytebuffers #78

Open TuomasKiviaho opened 1 year ago

TuomasKiviaho commented 1 year ago

Jackson has had NonBlockingByteBufferJsonParser from 2.14.

Could NonBlockingParserbe upgraded to accommodate to ByteBufferFeeder to avoid having to do memory copying when source is ByteBuffer

TuomasKiviaho commented 1 year ago

Currently JacksonResumableParser´ can't be extended to accommodate bytebuffers in similar way thatJacksonNonblockingParser` does. I suggest changing the class at least as protected to allow inheritance in case the implementation is not fit to be included to the project.

There are couple of simple and backwards compatible ways how to enhance the JacksonResumableParser that I spotted to do repeatable doPare calls minimal state testing inside the tight loop.

With these changes the doPare could be called multiple times when the feeding process has not been ended either by EOF or immediate stop and context pausing can hence be handled outside of the tight-loop to better meet the demands back-propagation concept of reactive streaming for instance.

wanglingsong commented 1 year ago

Hi @TuomasKiviaho , Thanks so much for the suggestion. I will look into it this week.