54 public static void main(String[] args)
throws Exception {
56 if (args.length != 2) {
57 System.out.println(
"Usage: URLDumper <URL> <file>");
61 String location = args[0];
62 String file = args[1];
64 URL url =
new URL(location);
65 FileOutputStream fos =
new FileOutputStream(file);
67 byte [] bytes =
new byte [4096];
69 InputStream is = url.openStream();
73 while ((read = is.read(bytes)) != -1) {
74 fos.write(bytes, 0, read);