Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.0
-
Fix Version/s: 1.8.1, 1.9-beta-1
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
JsonBuilder currently loads all of the data into an internal Map.
It would be really nice to have a JsonBuilder which takes a Writer as a constructor parameter, and writes to this writer as the document is constructed.
Unfortunatly, I think this would either require a rewrite of JsonBuilder, or a new class to handle this situation (StreamingJsonBuilder?)
Added a new class groovy.json.StreamingJsonBuilder which I believe covers this issue...
I have also copied the tests from JsonBuilderTests to StreamingJsonBuilderTests, removed the tests for writable, and ensured they all pass (I added an extra test for passing an empty Map and a Closure to the invokeMethod call)
Hopefully it's ok, can someone have a look and make sure I haven't missed anything? I always seem to miss something glaringly obvious