I have the follwing piece of code in my program:
try
{
URL url = new URL(link);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
int input;
String line = "";
while (in.ready())
{
input = in.read();
char a = (char)input;
line = line + a;
if(line.endsWith("<!-- S BO -->"))
{
while(!(line.endsWith("<!-- E BO -->")))
{
input = in.read();
a = (char)input;
line = line + a;
}
System.out.println("ended");
}
}
}
catch(Exception e) {}
All it's doing is looking for the "<!-- S BO -->" tag in a piece of HTML, and then looking for the "<!-- E BO -->" tag.
This code works perfectly in Windows on my computer, but if I connect to a Linux server to test it, the code runs but doesn't print anything to indicate that it found the tags. It's running on exactly the same input.
Is there something wrong with the code, or is there something else going wrong?
Thanks