Does XmlMtomReader cache binary data from the input stream internally?

半腔热情 提交于 2019-12-11 07:17:18

问题


Actually i'd like to know if XmlMtomReader reads mime binary parts from the input stream directly? Or does it store them internally before i call ReadContentAsBase64() method?


回答1:


As I recall (and it's been a while...), XmlMtomReader does the minimal amount of internal storage required, depending on the order in which the MIME parts appear in the input stream. (The MTOM standard allows them to appear in any order).

So if your input stream is, for example:

  • Binary part 1
  • Then the main XML part, e.g.

< a/ >< b >...binary part 1...< /b >< c >...binary part 2...< /c >< /d >

  • Then Binary part 2

Here's what happens:

  • To start reading the XML (element "a"), it must store Binary Part 1 internally
  • When you read contents of element "b", it comes from the internal storage
  • When you start reading element "c", it stores the rest of the XML internally (element "d"), and advances the stream to Binary Part 2. When you read the contents of element "c" at this point, it comes directly from the stream, not from storage.
  • When you lastly read element "d", the XML comes from internal storage


来源:https://stackoverflow.com/questions/1503711/does-xmlmtomreader-cache-binary-data-from-the-input-stream-internally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!