Thank you for your fast response Tatu, I've opened a github issue <https://github.com/FasterXML/jackson-dataformat-xml/issues/270>.
On Tuesday, November 14, 2017 at 12:21:42 PM UTC-7, Tatu Saloranta wrote: > > On Tue, Nov 14, 2017 at 9:54 AM, <[email protected] <javascript:>> > wrote: > > The regular UTF8 JSON Generator has a method: > > > > writeBinary(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 contents into memory > all at > > once. > > > > However, ToXmlGenerator does not implement this method. It only > implements a > > writeBinary overload that takes an already existing byte[ ]. > > > > Does anyone have a workaround that would allow me to achieve the same > JSON > > functionality but using the XML mapper and Generator? > > I think this is an oversight; when `InputStream` taking method was > added into base API, > XML backend was not modified. > In theory it should be possible to implement incremental encoder, > since Stax2 API does have method > for such write (either taking `InputStream`, or at least passing > chunks). There may be other issues > but I think you should file an issue for `jackson-dataformat-xml` > github repo and perhaps it could > be implemented. > > I don't know if there's a work-around without modifications to > `XmlGenerator`, problem being that there > is some buffering and state keeping -- you can certainly write to > underlying XMLStreamWriter2, but > it is not certain that generator's state would remain in usable > condition when by-passing it. > > -+ Tatu +- > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "jackson-user" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
