import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import javax.swing.text.html.parser.DTD;
public class MainClass
{
public static void main(String[] args)
{
try
{
URL u = new URL("http://www.java2s.com");
OutputStream out = new FileOutputStream("test.htm");
InputStream in = u.openStream();
DTD html = DTD.getDTD("html");
System.out.println(html.getName());
in.close();
out.flush();
out.close();
}
catch (Exception e) {
System.err.println("Usage: java PageSaver url local_file");
}
}
}
No comments:
Post a Comment