• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is Document object closes the open file

 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using
SAXBuilder xmlFilebuilder = new SAXBuilder();
Document xmlDocument = xmlFilebuilder.build(filePath);

to parse the XML file. But my application requires many hits to XML file.
the app I'm developing is getting one problem as "Too Many open files".
I'm using JDK 6.

I'm not closing the file explicitly as I don't have instance of file. I'm using SAXBuilder.
is Document object closes the object explicitly or not...

thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, Im not familiar with JDOM but generally we expect XML parsers to close the input stream no matter where it comes from.

You could always build a java.io.InputStream and use the build( inputstream ) then close the stream explicitly.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic