johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <>
Subject [jira] [Commented] (JOHNZON-153) Support streaming String values using Readable
Date Wed, 17 Jan 2018 19:16:00 GMT


Romain Manni-Bucau commented on JOHNZON-153:


not sure I'l fully following the use case, here how I see things:

1. any value should fit in memory by itself (doesn't mean all values should)
2. you can have your JsonStringImpl which lazily load the value from an inputstream/reader
and then drop the stream/value


> Support streaming String values using Readable
> ----------------------------------------------
>                 Key: JOHNZON-153
>                 URL:
>             Project: Johnzon
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Dirk Rudolph
>            Priority: Major
> Currently there are 2 ways writing a String value to JsonGenerator:
>  # using {{JsonGenerator#write(java.lang.String, javax.json.JsonValue)}} and {{JsonGenerator#write(javax.json.JsonValue)}}
respectively or
>  # using {{JsonGenerator#write(java.lang.String, java.lang.String)}} and {{JsonGenerator#write(java.lang.String)}}
> where in the former case {{JsonValue}} has to be a {{JsonString}} otherwise a ClassCastException
will be thrown in [JsonGeneratorImpl#writeJsonValue(java.lang.String, javax.json.JsonValue)|].
> It would be great to change that implementation detail so that a consumer can implement
its own implementation of {{JsonValue}} with {{ValueType#STRING}} but working with {{Reader}}
internally so that not the entire String is kept in memory. 
> The use case behind that I use johonzon to write a solr-json formatted list of update
commands for solr and want to use tika to parse (potentially huge) files into plain text
sending them as individual field in my json object. 

This message was sent by Atlassian JIRA

View raw message