java - SAXReader() timeout -


im having saxreader() parse , read rss-feed. want ensure wont try read long period. want ensure if reader hasnt received response or within x seconds, abort.

my code:

saxreader reader = new saxreader(); document doc = reader.read(new url(myurl)); 

this inside try/catch.

you can tweak urlconnection opening manually:

url myurl = geturltoload(); urlconnection con = myurl.openconnection() con.setconnecttimeout(1000); con.setreadtimeout(2000); inputstream in = con.getinputstream(); // parse in want 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -