Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM and Large Files

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: John Cowan <cowan AT ccil.org>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM and Large Files
  • Date: Wed, 26 Jul 2006 12:28:00 -0700

On Jul 26, 2006, at 12:16 PM, John Cowan wrote:

Tatu Saloranta scripsit:

Reason is that most (all?) parsers I
know of buffer their input, so adding
BufferedInputStream just adds one unnecessary memory
copy operation to the chain.

Well, apparently not. Whichever parser Mike is using obviously is not
buffering the InputStream.

TagSoup attempts to be smart about this: it examines the InputStream
to see if it is an instanceof BufferedInputStream, and only if it isn't
does TagSoup bother wrapping it. The same is done with a Reader.



AFAIK, Xerces reads in blocks of N bytes from the user provided InputStream into an internal buffer, where N is reasonably large, so there's to need for a user to explicitly wrap into a BufferedInputStream. (bnux does the same on input and output).

FWIW, Xerces also implements a releveant SAX property to control said block size:

parser.setProperty("http://apache.org/xml/properties/input-buffer- size", new Integer(8192));

Wolfgang.






Archive powered by MHonArc 2.6.24.

Top of Page