Im using the code below to start reading a URL at line 300 but i would like it to stop reading at line 360, as im a java novice could you indicate where im going wrong, every seems ok (i.e. starts at 300) but it does not stop at the required point?
Any suggestions where im going wrong?
Thanks
Code:
import java.net.*;
import java.io.*;
import java.util.StringTokenizer;
public class NetFile
{
public static void main(String args[])
{
String data;
DataInputStream file = null;
int post = 300; //Starting line
String url = "[URL unfurl="true"]http://www.javaworld.com/columns/jw-tips-index.shtml";[/URL] //Example
try
{
file = new DataInputStream((new URL(url)).openStream());
data = file.readLine();
while (data != null)
{
for(int x = 0; x < 360;)
{
while(x >= post)
{
System.out.println(data);
data=file.readLine();
StringTokenizer st = new StringTokenizer(data);
while(st.hasMoreElements())
{
String s = st.nextToken();
System.out.print(x + "\t" + s);
for(double j = 0; j < 1000000; j++) {} //Readable output
}
x++;
}
data=file.readLine();
x++;
}
}
}
catch(IOException e)
{
System.out.println("Error : " + e);
}
}
}
Any suggestions where im going wrong?
Thanks