InputStream not working?

Here's my code.

import java.net.URL;

import java.net.URLConnection;

import java.net.MalformedURLException;

import java.io.File;

import java.io.InputStream;

import java.io.BufferedWriter;

import java.io.FileWriter;

import java.io.IOException;

import java.util.Scanner;

publicclass Test

{

URL pageURL;

public Test(URL page)

{

pageURL = page;

}

publicvoid saveFile(File f)

{

Scanner in;

BufferedWriter out;

try

{

in =new Scanner(getStream(pageURL));

out =new BufferedWriter(new FileWriter(f));

while(in.hasNextLine())

{

out.write(in.nextLine());

}

in.close();

out.close();

}

catch(IOException e)

{

e.printStackTrace();

return;

}

}

public InputStream getStream(URL page)throws IOException

{

URLConnection conn = page.openConnection();

return conn.getInputStream();

}

publicstaticvoid main(String[] args)

{

//Scanner s = new Scanner(System.in);

URL url;

try

{

url =new URL(javax.swing.JOptionPane.showInputDialog(null,"Enter in a URL","URL:"));

}

catch(MalformedURLException e)

{

e.printStackTrace();

return;

}

Test saver =new Test(url);

saver.saveFile(new File("C:\\Test.html"));

}

}

The resulting file does not render the same way as if I just opened the page with Firefox. Does anyone know why this is? I didn't check line for line, but the file look to be the same as the source of the page.

[3385 byte] By [Rob_Ha] at [2007-11-27 0:54:57]
# 1
It probably refers to style sheets that you haven't downloaded.
ejpa at 2007-7-11 23:27:32 > top of Java-index,Java Essentials,Java Programming...
# 2
Or perhaps the HTML contains links to relative URL's that exist relative to where you downloaded it from, but not relative to your C drive's root directory.
DrClapa at 2007-7-11 23:27:32 > top of Java-index,Java Essentials,Java Programming...
# 3
Or (less likely) you wrote the HTML to your disk file using a different encoding than the one it was actually in.
DrClapa at 2007-7-11 23:27:32 > top of Java-index,Java Essentials,Java Programming...