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 support for writeBinary() with InputStream to ToXMLGenerator #270

Closed
christian-x7h opened this issue Nov 14, 2017 · 2 comments
Closed
Milestone

Comments

@christian-x7h
Copy link

christian-x7h commented Nov 14, 2017

The regular UTF8JSONGenerator has a method:

writeBinary(Base64Variant b64variant, InputStream data, int dataLength)

That supports reading an InputStream, converting the binary stream to Base64, and directly writing to the content output. Thereby saving some memory by not having to load the entire stream's content into memory all at once.

However, ToXmlGenerator does not implement this method. It only implements a writeBinary overload that takes an already existing byte[].

I first reported this issue on the jackson-user google group, and @cowtowncoder suggested I open an issue on GitHub.

@marc-christian-schulze
Copy link

I just came across the same issue because my object serialization was working only under some circumstances, e.g. if the ByteBuffer has an underlying array to read from. If not, due to the implementation of the ByteBufferSerializer, the serializer falls back to the stream writer method which is apparently not supported. o.O
Would be glad to have at least one working implementation - even if it's caching the whole data first in a byte[] before writing.

@cowtowncoder
Copy link
Member

Ah shoot. I missed this one for 2.9.7.

@cowtowncoder cowtowncoder changed the title Add support for writeBinary with InputStreams to ToXMLGenerator Add support for writeBinary() with InputStream to ToXMLGenerator Dec 6, 2018
@cowtowncoder cowtowncoder added this to the 2.9.8 milestone Dec 6, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants