Navigation Menu

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

Add 'Appendable' as a destination for Gson #52

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 4 comments
Closed

Add 'Appendable' as a destination for Gson #52

GoogleCodeExporter opened this issue Mar 19, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Currently, Gson can generate a String or write to a Writer.  This can result in 
unnecessary temporary 
String objects when the user wants to embed Gson in a larger response.  Both 
StringBuilder and 
Writer share a common interface however: Appendable.  Since it is unlikely that 
the flush and close 
methods are called on Writer while serializing, consider either adding 
Appendable as a destination 
or replacing Writable with Appendable as the stream output type.

Original issue reported on code.google.com by complexm...@gmail.com on 1 Oct 2008 at 9:32

@GoogleCodeExporter
Copy link
Author

Note that java.lang.Appendable first appeared in Java 1.5

Original comment by damiancarrillo on 6 Oct 2008 at 9:53

@GoogleCodeExporter
Copy link
Author

Original comment by joel.leitch@gmail.com on 13 Oct 2008 at 7:26

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Fixed in r315

Note that this breaks backwards binary compatibility while preserving backwards
source compatibility. This is so because we changed the toJson() method 
signatures
instead of adding new methods. However, since Appendable is a super class of 
Writer,
a simple recompilation of code should be sufficient. Since this bug fix will go 
in a
major release, this is acceptable.

Original comment by inder123 on 26 Nov 2008 at 7:15

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by inder123 on 26 Nov 2008 at 7:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant