FasterXML / FasterXML/jackson-core
Add support for char-based NonBlockingInputFeeder
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 928
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Description
`NonBlockingInputFeeder` currently has two sub-interfaces, `ByteArrayFeeder` with implementation `NonBlockingByteArrayJsonParser` and `ByteBufferFeeder` with implementation `NonBlockingByteBufferJsonParser`. These only work with bytes though. It's possible to use `NonBlockingByteBufferJsonParser` for `char[]` or `CharBuffer` by converting the latter to `ByteBuffer` (`StandardCharsets.UTF_8.encode(charBuffer)`). However, `currentLocation()` and `currentTokenLocation()` return -1 from `getCharOffset()`, because the counter is only maintained for bytes. That makes it impossible for me to use non-blocking parsing in one of my projects, where the locations are essential.
It would be nice to have the following additional classes and interfaces:
* interface `CharArrayFeeder`: a copy of `ByteArrayFeeder` but for `char[]`
* interface `CharBufferFeeder`: a copy of `ByteBufferFeeder` but for `CharBuffer`
* class `NonBlockingCharArrayJsonParser implements CharArrayFeeder`
* class `NonBlockingCharBufferJsonParser implements CharBufferFeeder`
I see one issue with this however. These two classes would ideally (indirectly) extend `NonBlockingJsonParserBase`, because that one is "Intermediate base class for non-blocking JSON parsers". That class is written for parsing from bytes though, with fields like `_symbols` and `_pendingBytes`, and updating it to also support parsing from chars is probably difficult in a non-breaking way. Maybe someone can think of a nice way to overcome this issue.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.