Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've created a possible approach for addressing Issue #17 .
First, I added the abstract method declaration in JsonGenerator. Next, I added implementations of this method in two of the JsonGenerator implementations. Iin one implementation of the JsonGenerator (WriterBasedJsonGenerator), I created a separate buffer field in the class (using new char[] to avoid calling the same IOContext.allocX method twice which apparently results in an exception). In another implementation of the JsonGenerator (UTF8JsonGenerator), I tried to reuse the (apparently pre-existing) _charBuffer. I am not sure if these are the best approaches for getting a char[] for use as a temporary buffer for reading from a Reader. Then, I added an implementation in the JsonGeneratorDelegate that calls the appropriate function of the delegate instance.
As for a unit test, I copied one of the pre-existing unit test files (StringGenerationTest) and created a new version (StringGenerationReaderTest to avoid deleting the original tests) In StringGenerationReaderTest, the boolean parameters to the methods are removed (as it only tests using a Reader). Also, each function calls
where it would previously call
where text is the name of the String variable with the text to write.
Let me know if there is anything I can do to further test and/or improve this approach.