On Mon, Aug 21, 2017 at 9:32 AM, Bwmat <[email protected]> wrote:
> Thanks, that helps. > > I assume methods that may require multiple tokens, such as > readValueAsTree(), won't work? > Correct, they will not reliably work -- if input happens to be available they will, but unless this can be guaranteed (... in which case non-blocking may not be valuable anyway) they should not be used. -+ Tatu +- > > > On Sunday, August 20, 2017 at 5:11:48 PM UTC-7, Tatu Saloranta wrote: > >> I hope others have something, but for now examples from `jackson-core` >> tests may have to suffice. >> Or, anything that describes how `aalto-xml` non-blocking mode works >> should be highly applicable. >> >> In nutshell, the only differences are: >> >> 1. You must construct non-blocking parser with new method >> `createNonBlockingByteArrayParser()` -- it does NOT take input source >> 2. To feed input, you call method `getNonBlockingInputFeeder()` of >> non-blocking parser from step (1) >> 3. All reading is exactly using normal `JsonParser` methods, but >> `nextToken()` will return `NOT_AVAILABLE` if there isn't enough input >> for more tokens yet (but input source is not closed yet) >> 4. You should only feed more input: >> (a) First time right after constructing parser (no input buffered) >> (b) Once parser returns `NOT_AVAILABLE`, to indicate it has >> consumed input fed so far >> (c) After all input has been fed, and parser has consumed all >> input, `endOfInput()` should be called to indicate end-of-input >> >> I hope this helps, >> >> -+ Tatu +- >> >> ps. I hope to find time and inspiration to write blog post or two >> about non-blocking parser; but I would be especially happy if someone >> else writes one and sends a link -- I will link all articles from >> jackson portal page >> >> >> On Tue, Aug 15, 2017 at 6:19 PM, Bwmat <[email protected]> wrote: >> > I'm interested in https://github.com/FasterXML/jackson-core/issues/57 >> , is >> > there any documentation/examples? >> > >> > Thanks, >> > Matthew w. >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "jackson-user" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "jackson-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
