Parsing very large XML documents (and a bit more) in java

后端 未结 6 776
青春惊慌失措
青春惊慌失措 2020-11-30 05:56

(All of the following is to be written in Java)

I have to build an application that will take as input XML documents that are, potentially, very large. The document

6条回答
  •  死守一世寂寞
    2020-11-30 06:36

    You could use a BufferedInputStream with a very large buffer size and use mark() before the extension class works and reset() afterwards.

    If the parts the extension class needs is very far into the file, then this might become extremely memory intensive, 'though.

    A more general solution would be to write your own BufferedInputStream-workalike that buffers to the disk if the data that is to be buffered exceeds some preset threshold.

提交回复
热议问题