-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
SerializableString
value can not directly render to Writer
#480
Comments
I am not sure I understand: there is no significant difference between operation modes for I guess this could be different for custom implementations that just wrap array(s)? I think I could change |
Yeah, I did not explain very well.
Yes that would help and address our issue. |
We plan to implement an |
SerializableString
value can not directly render to Writer
Awesome, thank you! |
We have a
JsonGenerator
on aWriter
. We would like to write Java 8 Date Time values to JSON. We would like to do so by avoiding intermediate objects and garbage like theString
object but instead directly render to theWriter
. At first we thought we could achieve this asDateTimeFormatter
allows appending to aAppendable
andWriter
implementAppendable
. We thought that by implementingSerializableString
we could achieve this. Unfortunately this does not work as WriterBasedJsonGenerator#writeString(SerializableString) always creates achar[]
intermediate object. This is in contrast to UTF8JsonGenerator#writeString(SerializableString) which allows directly rendering to the output buffer without creating intermediate objects/garbage.Ideally the
SerializableString
would be changed but in your case the intended outcome would be achieved ifWriterBasedJsonGenerator#writeString
would call#appendQuoted(char[], int)
instead.This is with Jackson 2.9.6.
The text was updated successfully, but these errors were encountered: