I need to write a servlet which gets a specified web page and searches it's contents.
What is the best way to do this. I've read a jGuru posting which suggests using

URL url = new URL("http://www.someurl.com/logo.gif");
URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
BufferedInputStream in = new BufferedInputStream(stream);
FileOutputStream file = new FileOutputStream("logo.gif");
BufferedOutputStream out = new BufferedOutputStream(file);

int i;

while ((i = in.read()) != -1) {

but as you can tell this grabs a file and stores it as a file. I need to get the web page and search it, not store it as a file. I am really new at this and would appreciate any assistance. Thank you.