I am trying to make a program that will grab information line by line from a .txt document on the web and one that will continue to do so as the information is updated. So far I have this code and it does grab it from the website line by line, but when I upload an updated .txt file with more lines, the program doesn't grab the new ones. How can I make it do that?
try
{
URL url = new URL("http://www.zachburtle.com/Ye.txt");
URLConnection connection = url.openConnection();
connection.setDoInput(true);
InputStream inStream = connection.getInputStream();
BufferedReader input = new BufferedReader(new InputStreamReader(inStream));
String line = ".";
int previousCount = 0;
while(true)
{
int count = 1;
line = input.readLine();
while(line != null)
{
if (line != null)
{
previousCount = count;
++count;
}
if(previousCount < count && line != null)
{
System.out.println(line);
}
line = null;
}
}
}