Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:52:27+00:00 2026-05-23T18:52:27+00:00

I am reading a remote file(xml) that is rendered by a webserver on the

  • 0

I am reading a remote file(xml) that is rendered by a webserver on the fly.Sometimes the webserver takes time to render the remote file.
Sometime there is issue with netowrk and remote url is not reachable
Am using the following code:

URL url = new URL(myurl);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
String strOutput = "";
System.out.println("start now");
//my code hangs after  priting start now    sometime.
//i think in.ready blocks the code flow.
if(in.ready() ){         
  while ((inputLine = in.readLine()) != null) {
       strOutput = strOutput + inputLine;
  }
}

If input stream is not ready i want my code to continue withoud blocking.How can i handle it?

How can i make sure that my code flow is never blocked indefinately?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:52:27+00:00Added an answer on May 23, 2026 at 6:52 pm

    You can set time out on the URL connection. See javadocs.

    But you will have to get your stream slightly differently:

    URLConnection con = url.openConnection();
    con.setReadTimeout(timeout);
    InputStream in = con.getInputStream();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do i ignore exceptions in c#? i am reading a remote xml file,
I'm reading a remote XML file and once the XML is loaded into an
I have a php script that is reading a remote CSV file, and adding
I'm currently reading a regularly updated XML file with PHP (simpleXML). I'd like to
Hey I am currently reading in a XML file which contains bullet list in
I am reading the input Excel file and in that i have 1 fields
I am developing a little app that retrieves an XML file, located on a
I am trying to write a script that will read a remote sitemap.xml and
I'm familiar with using the MSXML2 library for reading xml files. But is there
I am loading an XML file in my local server (not a remote server)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.