Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it optional transforming InputStream to String by default #2

Open
sberyozkin opened this issue May 13, 2015 · 0 comments
Open

Comments

@sberyozkin
Copy link
Contributor

Here are my comments to the patch: very good idea to abstract the details of how the sequence is read but unfortunately the way it is implemented it is too intrusive for the existing consumers of JsonObject/JsonArray.

Let me suggest a minor improvement to your patch, the idea stays the same but we will keep the existing code intact.

You've introduced JsonTokenerAbstract as the base 'interface'. Instead we should have an actual interface introduced, say 'JsonTokenerProvider'. Next you have your JsonTokenerAbstract implementing JsonTokenerProvider, where JsonTokenerProvider has the methods which are currently marked as abstract in JsonTokenerAbstract.
Introduce two JsonTokenerProvider interface implementations, both indeed extending JsonTokenerAbstract: one would use the existing String based JsonTokener, the other one would be a Reader based.
Add new constructors to JsonObject/etc accepting JsonTokenerProvider interface and Reader.
update existing constructors accepting JsonTokener by wrapping it into one of JsonTokenerProvider implementations and delegating to the constructor accepting JsonTokenerProvider. Similarly for new constructors accepting Reader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant