Added an example for streaming#3
Open
parj wants to merge 3 commits into
Open
Conversation
danielflower
requested changes
Jan 6, 2024
danielflower
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the pull request. I just had a couple of minor comments.
| if (count > 0) { | ||
| writer.write(",\n"); | ||
| } | ||
| String jsonR = new StringBuilder() |
Contributor
There was a problem hiding this comment.
It would be better to just to the writer directly. It is already buffered so no need to create a string builder.
I'm not a big fan of creating JSON this way as you need to json-encode everything properly... could use a org.json.JSONWriter but perhaps that is overcomplicated for this example, and just using strings is more straightforward for demo purposes. So okay.
|
|
||
| <p>Streaming can be done by implementing <code>StreamingOutput</code>. One use-case for this is to stream large data sets | ||
| back, without having to read the entre data set into memory. To reduce memory consumption even further, | ||
| <code>StringBuffer</code> is used to build the JSON.</p> |
Contributor
There was a problem hiding this comment.
Remove this bit about string buffer.
Author
|
Changes completed - let me know if they look good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.