I'm testing some code that reads data from a text file off of the internet using InputStreamReader. It worked the first time and returned the correct results; however, I've tried changing the contents of the file and even removing the file off of the server altogether, and the results returned always remain the same. I am also restarting the program fresh every time I check.
Then, I tried pointing the InputStreamReader to a different location by changing the URL object (to a nonexistent object), and finally, it did not find the file, as expected.
Does anyone know what could be causing this?
Here is the code:
URL serverips = new URL("<URL redacted>");
BufferedReader in = new BufferedReader(new InputStreamReader(
serverips.openStream()));
String ip = in.readLine();
while (ip != null) {
System.out.println("found server ip: " + ip);
ip = in.readLine();
}
Of course, I've also tried loading the URL via browser, and it behaves as expected (the displayed data changes when I change the contents of the hosted file).